diff --git a/lib/slack.js b/lib/slack.js index b76fc7619..2a04df938 100644 --- a/lib/slack.js +++ b/lib/slack.js @@ -29,8 +29,15 @@ class Slack extends webhook_1.IncomingWebhook { const context = github.context; const { sha, eventName, workflow, ref } = context; const { owner, repo } = context.repo; + const { number } = context.issue; const repo_url = `https://github.com/${owner}/${repo}`; - const action_url = `${repo_url}/commit/${sha}/checks`; + let action_url = repo_url; + if (eventName === 'pull_request') { + action_url += `/pull/${number}/checks`; + } + else { + action_url += `/commit/${sha}/checks`; + } const blocks = { type: 'section', fields: [ diff --git a/src/slack.ts b/src/slack.ts index 4576dfe14..865e3205b 100644 --- a/src/slack.ts +++ b/src/slack.ts @@ -29,8 +29,15 @@ export class Slack extends IncomingWebhook { const context = github.context; const { sha, eventName, workflow, ref } = context; const { owner, repo } = context.repo; + const { number } = context.issue; const repo_url: string = `https://github.com/${owner}/${repo}`; - const action_url: string = `${repo_url}/commit/${sha}/checks`; + let action_url: string = repo_url; + + if (eventName === 'pull_request') { + action_url += `/pull/${number}/checks` + } else { + action_url += `/commit/${sha}/checks`; + } const blocks: SectionBlock = { type: 'section',