Skip to content

Commit b11dbc5

Browse files
claudeluhenry
authored andcommitted
Stack manifest commits on auto/update-manifest instead of force-push
Check out the existing PR branch (if any) before regenerating versions-manifest.json, so each workflow run appends a new commit on top of prior ones rather than replacing them via force-push. The manifest diff now compares against the branch state, not main, avoiding spurious re-commits of identical content.
1 parent a0e1aa5 commit b11dbc5

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

.github/workflows/update-manifest.yml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,20 @@ jobs:
3636
with:
3737
python-version: '3.12'
3838

39+
- name: Setup git user
40+
run: |
41+
git config user.name 'github-actions[bot]'
42+
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
43+
44+
- name: Switch to PR branch
45+
run: |
46+
if git ls-remote --exit-code --heads origin "$PR_BRANCH" >/dev/null; then
47+
git fetch origin "$PR_BRANCH"
48+
git switch -c "$PR_BRANCH" "origin/$PR_BRANCH"
49+
else
50+
git switch -C "$PR_BRANCH"
51+
fi
52+
3953
- name: Regenerate manifest
4054
run: python .github/scripts/update-manifest.py
4155

@@ -46,15 +60,12 @@ jobs:
4660
exit 0
4761
fi
4862
49-
git config user.name 'github-actions[bot]'
50-
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
51-
git switch -C "$PR_BRANCH"
5263
git add versions-manifest.json
5364
git commit -m "Update versions-manifest.json"
54-
git push --force origin "$PR_BRANCH"
65+
git push origin "$PR_BRANCH"
5566
5667
if gh pr list --repo "$GITHUB_REPOSITORY" --head "$PR_BRANCH" --state open --json number -q '.[].number' | grep -q .; then
57-
echo "Existing PR updated via force-push"
68+
echo "Existing PR updated"
5869
else
5970
gh pr create --repo "$GITHUB_REPOSITORY" \
6071
--base main \

0 commit comments

Comments
 (0)