Skip to content

Commit 524db89

Browse files
committed
Open preview link in new tab, fix output for 'Trigggered by'
1 parent ebc0e95 commit 524db89

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

.github/workflows/deployment.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,13 @@ jobs:
139139
const commitUrl = sha
140140
? `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${sha}`
141141
: `https://github.com/${context.repo.owner}/${context.repo.repo}`;
142-
const actor = workflowRun.actor ?? 'workflow_run';
142+
const actorLogin = typeof workflowRun.actor === 'string'
143+
? workflowRun.actor
144+
: workflowRun.actor?.login;
145+
const actor = actorLogin ?? context.actor ?? 'workflow_run';
146+
const actorLink = workflowRun.actor?.html_url || (actorLogin ? `https://github.com/${actorLogin}` : null);
147+
const actorDisplay = actor.startsWith('@') ? actor : `@${actor}`;
148+
const triggeredBy = actorLink ? `[${actorDisplay}](${actorLink})` : actorDisplay;
143149
144150
const body = [
145151
commentTag,
@@ -149,9 +155,9 @@ jobs:
149155
'| --- | --- |',
150156
`| Branch | \`${branch}\` |`,
151157
`| Commit | [${shortSha}](${commitUrl}) |`,
152-
`| Preview | [Open preview](${previewUrl}) |`,
158+
`| Preview | <a href="${previewUrl}" target="_blank" rel="noopener noreferrer">Open preview</a> |`,
153159
'',
154-
`_Triggered by @${actor}_`
160+
`_Triggered by ${triggeredBy}_`
155161
].join('\n');
156162
157163
const comments = await github.paginate(github.rest.issues.listComments, {

0 commit comments

Comments
 (0)