Skip to content

Commit 8bc2869

Browse files
committed
Add rebase CI
1 parent 01217ac commit 8bc2869

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/rebase.yaml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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+
env:
15+
BASE_BRANCH: release-ci
16+
UPSTREAM_REPO: https://github.com/haskell/cabal.git
17+
UPSTREAM_BRANCH: master
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
with:
22+
ref: ${{ env.BASE_BRANCH }}
23+
fetch-depth: 0
24+
25+
- run: |
26+
set -eux
27+
28+
base_branch=${{ env.BASE_BRANCH }}
29+
upstream_repo=${{ env.UPSTREAM_REPO }}
30+
upstream_branch=${{ env.UPSTREAM_BRANCH }}
31+
32+
git remote add upstream "${upstream_repo}"
33+
git fetch upstream
34+
git fetch origin
35+
git status
36+
git --version
37+
common_ancestor=$(git merge-base "${base_branch}" "upstream/${upstream_branch}")
38+
git format-patch "${common_ancestor}".."${base_branch}"
39+
git archive "${base_branch}" > backup.tar
40+
tar -rf backup.tar .git
41+
git am *.patch
42+
git push -f origin master-rebased
43+
44+
- if: always()
45+
name: Upload backup
46+
uses: actions/upload-artifact@v4
47+
with:
48+
if-no-files-found: error
49+
retention-days: 7
50+
name: backup
51+
path: |
52+
./backup.tar

0 commit comments

Comments
 (0)