ci: use matrix to allow multiple fork owners in sync-fork action #128
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Fork | |
on: | |
schedule: | |
- cron: '0 11 * * *' # once every day | |
workflow_dispatch: # on button click | |
push: | |
paths: | |
- .github/workflows/sync-fork.yml | |
permissions: | |
contents: write | |
env: | |
GH_TOKEN: ${{ github.token }} | |
UPSTREAM_OWNER: CCBR | |
jobs: | |
sync: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
FORK_OWNER: [NCIPangea] | |
steps: | |
- name: sync fork | |
# only run this action from the forked repo | |
if: ${{ github.repository_owner == matrix.FORK_OWNER }} | |
run: | | |
# required for actions scheduled via cron, as github.event.repository.name won't work | |
echo "REPO=$(basename ${{ github.repository }})" >> $GITHUB_ENV | |
# sync the fork from upstream | |
gh repo sync ${{ github.repository }} --source $UPSTREAM_OWNER/$REPO --force |