Skip to content

Commit

Permalink
Fix merge build handling in GitHub Actions (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
job13er authored Apr 25, 2023
1 parent 16d6d0d commit 63dba2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/tests/utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ describe('utils', () => {

describe('when doing a merge build', () => {
beforeEach(() => {
env.GITHUB_REF = 'main'
env.GITHUB_REF = 'refs/heads/main'

saveEnv(Object.keys(env), realEnv)
setEnv(env)
Expand Down
3 changes: 2 additions & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ function processEnv(config) {
// If still no prNumber, check ref (some CIs don't have prNumber or prUrl)
if (config.computed.ci.prNumber === 'false') {
const parts = getEnv(config.ci.env.ref, '').split('/')
config.computed.ci.prNumber = parts[parts.length - 2] || 'false'
const prNumber = parseInt(parts[parts.length - 2], 10)
config.computed.ci.prNumber = prNumber ? String(prNumber) : 'false'
}

config.computed.ci.isPr = config.computed.ci.prNumber !== 'false'
Expand Down

0 comments on commit 63dba2b

Please sign in to comment.