Skip to content

Commit 9fe2a82

Browse files
committed
keepalive: in forks, merge the upstream branch instead of creating commits
In the fork in `gitgitgadget-workflows/gitgitgadget-workflows`, we now have a divergent commit history. That is because both that fork as well as the upstream repository in `gitgitgadget/gitgitgadget-workflows` create those keepalive commits. That is not ideal. Let's instead merge the upstream branch in forked repositories, which will include that already-created keepalive commit. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 9c0c7e1 commit 9fe2a82

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

.github/workflows/keepalive.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,19 @@ jobs:
1717
- uses: actions/checkout@v4
1818
with:
1919
persist-credentials: 'true'
20+
- name: Merge the upstream default branch
21+
id: merge
22+
if: github.event.repository.fork == true
23+
run: |
24+
git fetch https://github.com/gitgitgadget/gitgitgadget-workflows HEAD &&
25+
if test 0 = $(git rev-list --count HEAD..FETCH_HEAD)
26+
then
27+
exit 0 # let the next step create a commit
28+
fi &&
29+
git merge --no-edit FETCH_HEAD &&
30+
echo "result=merged" >>$GITHUB_OUTPUT
2031
- name: Create a commit
32+
if: steps.merge.outputs.result != 'merged'
2133
run: |
2234
mkdir -p .github/cached
2335
file='.github/cached/keepalive.txt'

0 commit comments

Comments
 (0)