|
1 |
| -name: Sync Fork |
| 1 | +name: 'Upstream Sync' |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | schedule:
|
5 |
| - - cron: '0 5 * * *' # This will run the workflow daily at midnight |
6 |
| - # workflow_dispatch: # This allows manual triggering |
| 5 | + - cron: '0 2 * * *' # This will run the workflow daily at midnight |
| 6 | + |
| 7 | + workflow_dispatch: # click the button on Github repo! |
7 | 8 |
|
8 | 9 | jobs:
|
9 |
| - sync: |
| 10 | + sync_latest_from_upstream: |
10 | 11 | runs-on: ubuntu-latest
|
| 12 | + name: Sync latest commits from upstream repo |
| 13 | + |
11 | 14 | steps:
|
12 |
| - - name: Checkout |
13 |
| - uses: actions/checkout@v2 |
| 15 | + # REQUIRED step |
| 16 | + # Step 1: run a standard checkout action, provided by github |
| 17 | + - name: Checkout target repo |
| 18 | + uses: actions/checkout@v3 |
| 19 | + with: |
| 20 | + # optional: set the branch to checkout, |
| 21 | + # sync action checks out your 'target_sync_branch' anyway |
| 22 | + ref: master |
| 23 | + # REQUIRED if your upstream repo is private (see wiki) |
| 24 | + persist-credentials: false |
14 | 25 |
|
15 |
| - - name: Sync fork |
16 |
| - uses: aormsby/Fork-Sync-With-Upstream-action@v2.3 |
| 26 | + # REQUIRED step |
| 27 | + # Step 2: run the sync action |
| 28 | + - name: Sync upstream changes |
| 29 | + id: sync |
| 30 | + uses: aormsby/Fork-Sync-With-Upstream-action@v3.4 |
17 | 31 | with:
|
18 |
| - github_token: ${{ secrets.GITHUB_TOKEN }} |
19 |
| - upstream_repository: jamesqquick/Build-A-Quiz-App-With-HTML-CSS-and-JavaScript # Replace with the original repo's username and name |
20 |
| - target_branch: main # Replace with the branch you want to sync |
| 32 | + target_sync_branch: master |
| 33 | + # REQUIRED 'target_repo_token' exactly like this! |
| 34 | + target_repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + upstream_sync_branch: master |
| 36 | + upstream_sync_repo: jamesqquick/Build-A-Quiz-App-With-HTML-CSS-and-JavaScript |
| 37 | + upstream_repo_access_token: ${{ secrets.UPSTREAM_REPO_SECRET }} |
| 38 | + |
| 39 | + # Set test_mode true to run tests instead of the true action!! |
| 40 | + test_mode: false |
| 41 | + |
| 42 | + # Step 3: Display a sample message based on the sync output var 'has_new_commits' |
| 43 | + - name: New commits found |
| 44 | + if: steps.sync.outputs.has_new_commits == 'true' |
| 45 | + run: echo "New commits were found to sync." |
| 46 | + |
| 47 | + - name: No new commits |
| 48 | + if: steps.sync.outputs.has_new_commits == 'false' |
| 49 | + run: echo "There were no new commits." |
| 50 | + |
| 51 | + - name: Show value of 'has_new_commits' |
| 52 | + run: echo ${{ steps.sync.outputs.has_new_commits }} |
0 commit comments