Sync with H7 #914
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 with H7 | |
on: | |
push: | |
branches: [gh-workflows] | |
# "Scheduled workflows run on the latest commit on the default or base branch." | |
# However, this workflow is not on the default branch, so it does not actually run automatically. | |
schedule: | |
- cron: '8 */6 * * *' | |
# "To trigger the workflow_dispatch event, your workflow must be in the default branch." | |
# However, this workflow is not in the default branch. | |
# The following command may be used to run this workflow manually: | |
# gh workflow run sync.yml --repo OpenDRR/h7-framework --ref gh-workflows | |
# which the scheduled sync.yml workflow at OpenDRR/h7-riskprofiler does use to trigger this workflow. | |
workflow_dispatch: | |
jobs: | |
sync-with-h7: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout our own repo: OpenDRR/h7-framework" | |
uses: actions/checkout@v3 | |
with: | |
ref: riskprofiler | |
token: ${{ secrets.GH_PAT }} | |
fetch-depth: 0 | |
- name: Fetch and merge latest commits from upstream, and push to GitHub | |
run: | | |
set -x | |
git config checkout.defaultRemote origin | |
git config user.name github-actions | |
git config user.email [email protected] | |
git remote add upstream ${{ secrets.UPSTREAM_GIT_REPO }} | |
git fetch upstream --tags | |
git switch riskprofiler | |
git merge --ff-only upstream/riskprofiler | |
git switch master | |
git merge --ff-only upstream/master | |
git push origin --all | |
git push origin --tags |