Skip to content

trigger-workflow

trigger-workflow #58

name: "Update available dates"
on:
repository_dispatch:
types: [trigger-workflow]
jobs:
build-tree:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
repository-projects: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Set branch_date as today
id: set_date
run: echo "branch_date=$(date '+%Y-%m-%d')" >> $GITHUB_ENV
- name: Set year
id: set_year
run: echo "year_date=$(date '+%Y')" >> $GITHUB_ENV
- name: Access Payload Data
run: echo "${{ env.branch_date }}"
- name: Update available_df.csv
run: |
echo "\"${{ env.year_date }}\",\"4.5.1\",\"3.21\",\"${{ env.branch_date }}\",\"supported\",\"supported\",\"might work\"" >> inst/extdata/available_df.csv
- name: Push changes to update_default.nix branch
run: |
git config --global user.email "[email protected]"
git config --global user.name "CI Robot"
git add .
git commit -m "Updated available dates"
git push origin main:available_dates --force
- name: Check if PR exists
id: check_pr
run: |
PR=$(gh pr list -S 'Update available dates' --json number --jq '.[0].number')
echo "PR_NUMBER=$PR" >> $GITHUB_ENV
- name: Create Pull Request
if: env.PR_NUMBER == ''
uses: peter-evans/create-pull-request@v6
with:
branch: available_dates
title: 'Update available dates'
body: 'Automated PR to update available dates'
base: main
branch-suffix: ''