Skip to content

Commit c42352d

Browse files
committed
Re-running workflow no longer creates a new PR
* If a PR for the same version already exists, update the existing PR.
1 parent 453ca18 commit c42352d

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

.github/workflows/generate-release-maintenance.yaml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
release_tag:
7-
description: 'The release version (e.g., v2.11.10-alpha1)'
7+
description: 'The release tag (e.g., v2.11.10-alpha1)'
88
required: true
99
release_date:
1010
description: 'The release date (e.g., Jan 28, 2026)'
@@ -56,10 +56,18 @@ jobs:
5656
git checkout -b "$BRANCH_NAME"
5757
git add .
5858
git commit -m "$VERSION - Release Maintenance"
59-
git push origin "$BRANCH_NAME"
59+
git push -f origin "$BRANCH_NAME"
6060
61-
gh pr create \
62-
--title "$VERSION - Release Maintenance" \
63-
--body "Automated release maintenance updates for version $VERSION."$'\n'"Command executed: \`./release-maintenance.sh -t \"$TAG\" -d \"$DATE\" --prime \"$PRIME\" --community \"$COMMUNITY\"\`" \
64-
--base "$BASE_BRANCH" \
65-
--head "$BRANCH_NAME"
61+
PR_NUMBER=$(gh pr list --head "$BRANCH_NAME" --base "$BASE_BRANCH" --json number --jq '.[0].number')
62+
63+
if [[ -n "$PR_NUMBER" && "$PR_NUMBER" != "null" ]]; then
64+
gh pr edit "$PR_NUMBER" \
65+
--title "$VERSION - Release Maintenance" \
66+
--body "Automated release maintenance updates for version $VERSION."$'\n'"Command executed: \`./release-maintenance.sh -t \"$TAG\" -d \"$DATE\" --prime \"$PRIME\" --community \"$COMMUNITY\"\`"
67+
else
68+
gh pr create \
69+
--title "$VERSION - Release Maintenance" \
70+
--body "Automated release maintenance updates for version $VERSION."$'\n'"Command executed: \`./release-maintenance.sh -t \"$TAG\" -d \"$DATE\" --prime \"$PRIME\" --community \"$COMMUNITY\"\`" \
71+
--base "$BASE_BRANCH" \
72+
--head "$BRANCH_NAME"
73+
fi

0 commit comments

Comments
 (0)