Sync Fork #14174
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: "*/30 * * * *" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
sync: | |
name: Sync with Upstream | |
runs-on: ubuntu-latest | |
if: github.repository_owner != '0xERR0R' | |
steps: | |
- name: Enabled Check | |
id: check | |
shell: bash | |
run: | | |
if [[ "${{ secrets.FORK_SYNC_TOKEN }}" != "" ]]; then | |
echo "enabled=1" >> $GITHUB_OUTPUT | |
echo "Workflow is enabled" | |
else | |
echo "enabled=0" >> $GITHUB_OUTPUT | |
( | |
echo 'Workflow is disabled (create `FORK_SYNC_TOKEN` secret with repo write permission to enable it)' | |
echo | |
echo 'Alternatively, you can disable it for your repo from the web UI:' | |
echo 'https://docs.github.com/en/actions/using-workflows/disabling-and-enabling-a-workflow' | |
) | tee "$GITHUB_STEP_SUMMARY" | |
fi | |
- name: Sync | |
if: ${{ steps.check.outputs.enabled == 1 }} | |
env: | |
GH_TOKEN: ${{ secrets.FORK_SYNC_TOKEN }} | |
shell: bash | |
run: | | |
gh repo sync ${{ github.repository }} -b main |