Skip to content

Commit

Permalink
chore(ci): update logging for release (#52357)
Browse files Browse the repository at this point in the history
```
Error: Command failed: git clone https://github.com/vercel/next.js --single-branch --branch v13.4.NaN --depth=20 /tmp/next-statsmIAdTr/main-repo
Cloning into '/tmp/next-statsmIAdTr/main-repo'...
warning: Could not find remote branch v13.4.NaN to clone.
fatal: Remote branch v13.4.NaN not found in upstream origin
```


https://github.com/vercel/next.js/actions/runs/5480032198/jobs/9982817862#step:7:1658

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
styfle and kodiakhq[bot] authored Jul 7, 2023
1 parent b2c6bc4 commit 27a252b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/actions/next-stats-action/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {
let mainRef = statsConfig.mainBranch

if (actionInfo.isRelease) {
logger('Release detected, using last stable tag')
logger(`Release detected, using last stable tag: "${actionInfo.prRef}"`)
const lastStableTag = await getLastStable(diffRepoDir, actionInfo.prRef)
mainRef = lastStableTag
mainNextSwcVersion = lastStableTag
if (!lastStableTag) throw new Error('failed to get last stable tag')
console.log('using latestStable', lastStableTag)
logger(`using latestStable: "${lastStableTag}"`)

/* eslint-disable-next-line */
actionInfo.lastStableTag = lastStableTag
Expand Down
11 changes: 8 additions & 3 deletions .github/actions/next-stats-action/src/prepare/repo-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ module.exports = (actionInfo) => {
const tag = stdout.trim()

if (!tag || !tag.startsWith('v')) {
throw new Error(`Failed to get tag info ${stdout}`)
throw new Error(`Failed to get tag info: "${stdout}"`)
}
const [major, minor, patch] = tag.split('-canary')[0].split('.')
if (!major || !minor || !patch) {
throw new Error(
`Failed to split tag into major/minor/patch: "${stdout}"`
)
}
const tagParts = tag.split('-canary')[0].split('.')
// last stable tag will always be 1 patch less than canary
return `${tagParts[0]}.${tagParts[1]}.${Number(tagParts[2]) - 1}`
return `${major}.${minor}.${Number(patch) - 1}`
},
async getCommitId(repoDir = '') {
const { stdout } = await exec(`cd ${repoDir} && git rev-parse HEAD`)
Expand Down

0 comments on commit 27a252b

Please sign in to comment.