forked from 0xERR0R/blocky
-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.17 KB
/
fork-sync.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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