Sometimes I do fork repositories and do some tweaks here and there for my personal needs which ain’t really going to be merged into the upstream repository.
One thing that used to concern me is that I needed to manually rebase my changes onto the upstream to have new goods but keep my changes on top of them.
Fortunately, GitHub Actions supports the
schedule trigger for workflows and this is what we are
going to use.
The CI plan is simple and straightforward:
- Tigger by a schedule or by a manual run.
- Fetch & checkout repository.
- Specify an upstream Git URL. Unfortunately, GitHub doesn’t expose an environment variable of a upstream repository (or I didn’t find it).
- Rebase onto upstream.
- Push changes.
name: 'Rebase' on: schedule: - cron: '*/15 * * * *' workflow_dispatch: jobs: rebase: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: shitiomatic/forkbacon@master with: upstream_url: "upstream url here" upstream_branch: "master" branch: "master" method: "rebase"
Almost there. GitHub doesn’t sync & install schedules for forked repositoies without a manual run or an additional push. Go to Actions, find Rebase workflow and click on the Run workflow button.
That’s it, really. If the rebase fails, GitHub will send you an email letting you know about it.