Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/milestones.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
gh api \
-H "Accept: application/vnd.github.raw" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/{owner}/{repo}/contents/include/VERSION?ref=${{ github.sha }}"
"/repos/{owner}/{repo}/contents/include/VERSION?ref=${{ github.event.pull_request.base.ref }}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What about merge_commit_sha in https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=closed#pull_request

In https://docs.github.com/en/rest/pulls/pulls?apiVersion=2026-03-10#get-a-pull-request, it shows that if the PR is merged (which is what is checked on line 13, then it is a sha (so less user-controllable).

Suggested change
"/repos/{owner}/{repo}/contents/include/VERSION?ref=${{ github.event.pull_request.base.ref }}"
"/repos/{owner}/{repo}/contents/include/VERSION?ref=${{ github.event.pull_request. merge_commit_sha }}"

It might still be needed to change into an env var to not evaluate the template directly for zizmor checks to be happy (which is a good thing).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the great catch and the security tip, @echoix! That makes total sense. I've updated the workflow to use merge_commit_sha and safely mapped it to an environment variable to keep zizmor happy. Appreciate the feedback!

echo "EOF"
} >> "${GITHUB_OUTPUT}"
env:
Expand Down
Loading