Skip to content

Commit a0db9dc

Browse files
Copilotcptartur
andcommitted
Fix auto-update workflow to not re-request reviewers if PR was not modified
Co-authored-by: cptartur <[email protected]>
1 parent 7c9a18d commit a0db9dc

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/auto-update-tools.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,12 @@ jobs:
232232
sed -i "s/SCRIPT_VERSION=\"${current_script_version}\"/SCRIPT_VERSION=\"${{ steps.bump_version.outputs.NEW_SCRIPT_VERSION }}\"/" starkup.sh
233233
234234
git add starkup.sh
235-
git commit -m "chore: auto-update tool versions to starkup ${{ steps.bump_version.outputs.NEW_SCRIPT_VERSION }}" || echo "No changes to commit"
235+
changes_committed=false
236+
if git commit -m "chore: auto-update tool versions to starkup ${{ steps.bump_version.outputs.NEW_SCRIPT_VERSION }}"; then
237+
changes_committed=true
238+
else
239+
echo "No changes to commit"
240+
fi
236241
git push origin "$branch_name" --force
237242
238243
pr_title="Bump tools; Prepare release ${{ steps.bump_version.outputs.NEW_SCRIPT_VERSION }}"
@@ -261,16 +266,23 @@ jobs:
261266
pr_body="${pr_body}- Starkup version: \`${current_script_version}\` → \`${{ steps.bump_version.outputs.NEW_SCRIPT_VERSION }}\`"
262267
pr_body_formatted=$(printf "%b" "$pr_body")
263268
269+
pr_created=false
264270
if gh pr list --head "$branch_name" --json number --jq '.[0].number' | grep -q .; then
265271
pr_number=$(gh pr list --head "$branch_name" --json number --jq '.[0].number')
266272
echo "Updating existing PR #$pr_number..."
267273
gh pr edit "$pr_number" --title "$pr_title" --body "$pr_body_formatted"
268274
else
269275
echo "Creating new PR..."
270276
gh pr create --title "$pr_title" --body "$pr_body_formatted" --label "dependencies"
277+
pr_created=true
271278
fi
272279
273-
# Request reviews using the value read before branch switch
274-
reviewers="${{ steps.read_reviewers.outputs.REVIEWERS }}"
275-
echo "Requesting reviews from: $reviewers"
276-
gh pr edit --add-reviewer "$reviewers"
280+
# Only request reviews if PR was newly created or changes were committed
281+
# This prevents re-requesting reviews on workflow reruns that don't modify the PR
282+
if [ "$pr_created" = "true" ] || [ "$changes_committed" = "true" ]; then
283+
reviewers="${{ steps.read_reviewers.outputs.REVIEWERS }}"
284+
echo "Requesting reviews from: $reviewers"
285+
gh pr edit --add-reviewer "$reviewers"
286+
else
287+
echo "Skipping reviewer request - no changes were made to the PR"
288+
fi

0 commit comments

Comments
 (0)