Skip to content

Commit 32a4204

Browse files
committed
Add rebase CI
1 parent 01217ac commit 32a4204

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/rebase.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Rebase against upstream
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
schedule:
8+
- cron: '15 3 * * *'
9+
10+
jobs:
11+
rebase:
12+
name: Rebase now!
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- run: |
19+
set -eux
20+
21+
base_branch=master
22+
upstream_repo=https://github.com/haskell/cabal.git
23+
upstream_branch=master
24+
25+
git remote add upstream "${upstream_repo}"
26+
git fetch upstream
27+
common_ancestor=$(git merge-base "${base_branch}" "upstream/${upstream_branch}")
28+
git format-patch "${common_ancestor}".."${base_branch}"
29+
git archive "${base_branch}" > backup.tar
30+
tar -rf backup.tar .git
31+
git am *.patch
32+
git push -f origin master-rebased
33+
34+
- if: always()
35+
name: Upload backup
36+
uses: actions/upload-artifact@v4
37+
with:
38+
if-no-files-found: error
39+
retention-days: 7
40+
name: backup
41+
path: |
42+
./backup.tar

0 commit comments

Comments
 (0)