Skip to content

Commit 4c98be0

Browse files
authored
Merge pull request #123 from github/lock-link-fixes
Lock Link Fixes
2 parents 719af08 + 588c231 commit 4c98be0

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

dist/index.js

Lines changed: 10 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/functions/lock.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,16 +381,19 @@ async function checkLockOwner(octokit, context, lockData, sticky, reactionId) {
381381
// dynamic lock text
382382
let lockText = ''
383383
let environmentText = ''
384+
var lockBranchForLink
384385
if (lockData.global === true) {
385386
lockText = dedent(
386387
`the \`global\` deployment lock is currently claimed by __${lockData.created_by}__
387388
388389
A \`global\` deployment lock prevents all other users from deploying to any environment except for the owner of the lock
389390
`
390391
)
392+
lockBranchForLink = GLOBAL_LOCK_BRANCH
391393
} else {
392394
lockText = `the \`${lockData.environment}\` environment deployment lock is currently claimed by __${lockData.created_by}__`
393395
environmentText = `- __Environment__: \`${lockData.environment}\``
396+
lockBranchForLink = `${lockData.environment}-${LOCK_BRANCH_SUFFIX}`
394397
}
395398

396399
// Construct the comment to add to the issue, alerting that the lock is already claimed
@@ -409,7 +412,7 @@ async function checkLockOwner(octokit, context, lockData, sticky, reactionId) {
409412
- __Sticky__: \`${lockData.sticky}\`
410413
- __Global__: \`${lockData.global}\`
411414
- __Comment Link__: [click here](${lockData.link})
412-
- __Lock Link__: [click here](${process.env.GITHUB_SERVER_URL}/${owner}/${repo}/blob/${LOCK_BRANCH_SUFFIX}/${LOCK_FILE})
415+
- __Lock Link__: [click here](${process.env.GITHUB_SERVER_URL}/${owner}/${repo}/blob/${lockBranchForLink}/${LOCK_FILE})
413416
414417
The current lock has been active for \`${totalTime}\`
415418
@@ -505,7 +508,11 @@ export async function lock(
505508
environment,
506509
global
507510
}
508-
} else if (globalLockData && detailsOnly && postDeployStep === false) {
511+
} else if (
512+
globalLockData &&
513+
detailsOnly === true &&
514+
postDeployStep === false
515+
) {
509516
// If the lock file exists and this is a detailsOnly request for the global lock, return the lock data
510517
return {
511518
status: 'details-only',

src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export async function run() {
266266
- __Global__: \`true\`
267267
`)
268268
core.info('there is a global deployment lock on this repository')
269-
lockBranchName = `global-${LOCK_METADATA.globalLockBranch}`
269+
lockBranchName = LOCK_METADATA.globalLockBranch
270270
}
271271

272272
// Format the lock details message

0 commit comments

Comments
 (0)