File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change 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 config user.email "[email protected] " 33+ git config user.name "GitHub CI"
34+
35+ git remote add upstream "${upstream_repo}"
36+ git fetch upstream
37+ git fetch origin
38+ git status
39+ git --version
40+ common_ancestor=$(git merge-base "${base_branch}" "upstream/${upstream_branch}")
41+ git format-patch "${common_ancestor}".."${base_branch}"
42+ git archive "${base_branch}" > backup.tar
43+ tar -rf backup.tar .git
44+ git reset --hard "upstream/${upstream_branch}"
45+ git am *.patch
46+ git push -f origin master-rebased
47+
48+ - if : always()
49+ name : Upload backup
50+ uses : actions/upload-artifact@v4
51+ with :
52+ if-no-files-found : error
53+ retention-days : 7
54+ name : backup
55+ path : |
56+ ./backup.tar
You can’t perform that action at this time.
0 commit comments