Skip to content

Commit

Permalink
ci: create sync workflow (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
bates64 authored Mar 24, 2024
2 parents de28246 + f87ed6e commit a891d8a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow tries to keep this repo in sync with upstream commits.
# It creates a pull request merging upstream into this repo.
# If the tests pass then the PR is automatically merged by GitHub.
name: Sync upstream
env:
UPSTREAM: pmret/papermario # If you forked dx, change this to star-haven/papermario-dx!
UPSTREAM_BRANCH: main
BASE_BRANCH: main
on:
workflow_dispatch:
repository_dispatch:
types:
- webhook # 'push' event on upstream
schedule:
- cron: 0 0 * * *
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ env.BASE_BRANCH }}
- name: Fetch upstream
run: git fetch https://github.com/${{ env.UPSTREAM }}.git ${UPSTREAM_BRANCH}
- name: Merge upstream
run: |
git checkout ${BASE_BRANCH}
git merge --no-ff --log FETCH_HEAD -m "Merge upstream changes"
- name: Push changes
run: git push origin ${BASE_BRANCH}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Pull Request
run: |
gh pr create --title "Sync with ${{ env.UPSTREAM }}" --body "Automated PR to keep this repository in sync with upstream. Beep boop." --base ${BASE_BRANCH}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit a891d8a

Please sign in to comment.