Unverified Commit 645eef54 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

Use existing commitId for tarball URL in stats action (#92899)

## Summary

PR #90709 introduced a `githubHeadSha` field in the stats action using
`event.after || GITHUB_SHA`, which can resolve to the wrong SHA for PR
events. The correct value was already available as `commitId` (from
`getCommitId()` = `git rev-parse HEAD` on the cloned PR branch).

- Use `commitId` for the tarball URL in `add-comment.js`
- Remove the redundant `githubHeadSha` field from `action-info.js`

## Test plan

- [ ] Verify the stats comment on a PR shows the correct tarball URL
matching the deployed artifact
parent 4fc3664e
......@@ -1030,13 +1030,13 @@ ${row}
}
function generatePrTarballSection(actionInfo) {
if (actionInfo.isRelease || !actionInfo.githubHeadSha) return ''
if (actionInfo.isRelease || !actionInfo.commitId) return ''
return `<details>
<summary><strong>📎 Tarball URL</strong></summary>
\`\`\`
https://vercel-packages.vercel.app/next/commits/${actionInfo.githubHeadSha}/next
https://vercel-packages.vercel.app/next/commits/${actionInfo.commitId}/next
\`\`\`
</details>
......
......@@ -8,7 +8,6 @@ module.exports = function actionInfo() {
ISSUE_ID,
SKIP_CLONE,
GITHUB_REF,
GITHUB_SHA,
LOCAL_STATS,
GIT_ROOT_DIR,
GITHUB_ACTION,
......@@ -56,9 +55,6 @@ module.exports = function actionInfo() {
prRef: GITHUB_REF,
isLocal: LOCAL_STATS,
commitId: null,
// Mirrors github.event.after || github.sha used by build_and_deploy.yml
// to ensure the tarball URL matches the deployed artifact.
githubHeadSha: GITHUB_SHA || null,
issueId: ISSUE_ID,
isRelease:
GITHUB_REPOSITORY === 'vercel/next.js' &&
......@@ -74,10 +70,6 @@ module.exports = function actionInfo() {
const event = require(GITHUB_EVENT_PATH)
info.actionName = event.action || info.actionName
if (event.after) {
info.githubHeadSha = event.after
}
if (releaseTypes.has(info.actionName)) {
info.isRelease = true
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment