|
--- |
|
name: Upstream Sync |
|
# https://github.com/marketplace/actions/upstream-sync |
|
|
|
on: |
|
schedule: |
|
- cron: '0 7 * * *' # 7am UTC, everyday |
|
push: |
|
branches: [automation] |
|
paths: |
|
- .github/workflows/sync.yml |
|
workflow_dispatch: |
|
|
|
concurrency: |
|
group: ${{ github.ref }}-${{ github.workflow }} |
|
cancel-in-progress: false |
|
|
|
jobs: |
|
sync: |
|
name: Sync to Upstream Repository |
|
runs-on: ubuntu-latest |
|
steps: |
|
- name: Checkout target repo |
|
uses: actions/checkout@v3 |
|
with: |
|
token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }} |
|
fetch-depth: 0 |
|
# optional: set the branch to checkout, |
|
# sync action checks out your 'target_sync_branch' anyway |
|
# ref: <branch> |
|
# REQUIRED if your upstream repo is private (see wiki) |
|
persist-credentials: false |
|
|
|
- name: Sync to Upstream Repository |
|
id: sync |
|
uses: aormsby/[email protected] |
|
with: |
|
target_sync_branch: <branch> |
|
target_repo_token: ${{ secrets.GH_PAT || secrets.GITHUB_TOKEN }} |
|
target_branch_push_args: --force --tags |
|
upstream_pull_args: --rebase=true --tags |
|
upstream_sync_branch: <branch> |
|
upstream_sync_repo: <upstream_profile>/<upstream_repo> |
|
upstream_repo_access_token: ${{ secrets.GH_PAT_UPSTREAM || secrets.GH_PAT || secrets.GITHUB_TOKEN }} |
|
git_config_user: ${{ github.actor }} |
|
git_config_email: ${{ github.actor }}@users.noreply.github.com |
|
git_config_pull_rebase: true |
|
# Set test_mode true to run tests instead of the true action!! |
|
test_mode: false |
|
|
|
# Display messages based on the sync output var 'has_new_commits' |
|
- name: New commits found |
|
if: steps.sync.outputs.has_new_commits == 'true' |
|
run: echo "New commits were found to sync." |
|
|
|
- name: No new commits |
|
if: steps.sync.outputs.has_new_commits == 'false' |
|
run: echo "There were no new commits." |
|
|
|
- name: Show value of 'has_new_commits' |
|
run: echo ${{ steps.sync.outputs.has_new_commits }} |
|
|
|
- name: Show value of 'has_new_commits' |
|
run: echo ${{ steps.sync.outputs.has_new_commits }} |