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} ...@@ -1030,13 +1030,13 @@ ${row}
} }
function generatePrTarballSection(actionInfo) { function generatePrTarballSection(actionInfo) {
if (actionInfo.isRelease || !actionInfo.githubHeadSha) return '' if (actionInfo.isRelease || !actionInfo.commitId) return ''
return `<details> return `<details>
<summary><strong>📎 Tarball URL</strong></summary> <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> </details>
......
...@@ -8,7 +8,6 @@ module.exports = function actionInfo() { ...@@ -8,7 +8,6 @@ module.exports = function actionInfo() {
ISSUE_ID, ISSUE_ID,
SKIP_CLONE, SKIP_CLONE,
GITHUB_REF, GITHUB_REF,
GITHUB_SHA,
LOCAL_STATS, LOCAL_STATS,
GIT_ROOT_DIR, GIT_ROOT_DIR,
GITHUB_ACTION, GITHUB_ACTION,
...@@ -56,9 +55,6 @@ module.exports = function actionInfo() { ...@@ -56,9 +55,6 @@ module.exports = function actionInfo() {
prRef: GITHUB_REF, prRef: GITHUB_REF,
isLocal: LOCAL_STATS, isLocal: LOCAL_STATS,
commitId: null, 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, issueId: ISSUE_ID,
isRelease: isRelease:
GITHUB_REPOSITORY === 'vercel/next.js' && GITHUB_REPOSITORY === 'vercel/next.js' &&
...@@ -74,10 +70,6 @@ module.exports = function actionInfo() { ...@@ -74,10 +70,6 @@ module.exports = function actionInfo() {
const event = require(GITHUB_EVENT_PATH) const event = require(GITHUB_EVENT_PATH)
info.actionName = event.action || info.actionName info.actionName = event.action || info.actionName
if (event.after) {
info.githubHeadSha = event.after
}
if (releaseTypes.has(info.actionName)) { if (releaseTypes.has(info.actionName)) {
info.isRelease = true info.isRelease = true
} else { } 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