Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/sync-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,19 @@
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create tag
if: steps.resolve-ref.outputs.should_create_tag == 'true' && steps.create-pr.outputs.changed == 'true'
if: steps.resolve-ref.outputs.should_create_tag == 'true'
run: |
Comment on lines 331 to 333
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Create tag step now runs whenever should_create_tag == 'true', even when steps.create-pr.outputs.changed is false. Since the script force-deletes and re-creates the annotated tag, re-running the workflow with no file changes will still rewrite the tag object (and may trigger downstream automation). Consider either restoring the changed == 'true' guard, or making tag creation idempotent by skipping delete/recreate when the existing tag already points to the intended commit.

Copilot uses AI. Check for mistakes.
echo "::group::Creating Tag"
cd gh-aw-actions

# When a PR was created and merged, we need to pull the merge commit from main
# because the working directory is still on the sync branch.
if [[ "${{ steps.create-pr.outputs.changed }}" == "true" ]]; then

Check notice

Code scanning / zizmor

code injection via template expansion Note

code injection via template expansion
echo "PR was merged — fetching main to tag the merge commit..."
git fetch origin main
git checkout -B main origin/main
Comment on lines +337 to +342
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tagging by checking out origin/main after the PR merge can tag the wrong commit if other commits land on main between the merge and this step. To ensure the tag points to the sync PR’s merge commit, capture the PR’s mergeCommit SHA (e.g., via gh pr view) and checkout/tag that specific SHA instead of origin/main HEAD.

Suggested change
# When a PR was created and merged, we need to pull the merge commit from main
# because the working directory is still on the sync branch.
if [[ "${{ steps.create-pr.outputs.changed }}" == "true" ]]; then
echo "PR was merged — fetching main to tag the merge commit..."
git fetch origin main
git checkout -B main origin/main
# When a PR was created and merged, we need to tag the merge commit for that PR
# rather than whatever commit happens to be at the tip of main when this step runs.
if [[ "${{ steps.create-pr.outputs.changed }}" == "true" ]]; then
echo "PR was merged — resolving merge commit SHA to tag..."
PR_NUMBER="${{ steps.create-pr.outputs.pr_number }}"
if [[ -z "$PR_NUMBER" ]]; then
echo "Error: PR number not available; cannot determine merge commit to tag." >&2
exit 1
fi
# Ensure gh is authenticated. Prefer an existing GH_TOKEN/GITHUB_TOKEN if set.
if [[ -z "${GH_TOKEN:-}" && -n "${GITHUB_TOKEN:-}" ]]; then
export GH_TOKEN="$GITHUB_TOKEN"
fi
MERGE_COMMIT_SHA="$(gh pr view "$PR_NUMBER" --json mergeCommit --jq '.mergeCommit.oid')"
if [[ -z "$MERGE_COMMIT_SHA" || "$MERGE_COMMIT_SHA" == "null" ]]; then
echo "Error: Could not determine merge commit SHA for PR #$PR_NUMBER." >&2
exit 1
fi
echo "Fetching and checking out merge commit $MERGE_COMMIT_SHA for PR #$PR_NUMBER..."
git fetch origin
git checkout "$MERGE_COMMIT_SHA"

Copilot uses AI. Check for mistakes.
fi

TAG="${{ steps.resolve-ref.outputs.raw_ref }}"
echo "Creating tag: $TAG"

Expand Down
Loading