Skip to content

Commit

Permalink
Support PR Link
Browse files Browse the repository at this point in the history
  • Loading branch information
danshapir committed Oct 30, 2023
1 parent a5d0d73 commit 8fc5a7f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
10 changes: 3 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ function run() {
const runnerOS = process.env.RUNNER_OS || "";
const actor = process.env.GITHUB_ACTOR || "";
const branch = process.env.GITHUB_REF || "";
const pr_title = process.env.PR_TITLE || undefined;
const pr_id = process.env.PR_ID || undefined;
const pr_link = process.env.PR_LINK || undefined;
const commit_message = process.env.COMMIT_MESSAGE || undefined;
const sha = process.env.COMMIT_SHA || "";
const customId = JSON.stringify({
Expand All @@ -65,11 +64,8 @@ function run() {
{ type: "mrkdwn", text: `*Env:* ${env}` },
];
// Add PR details only if they exist:
if (pr_title) {
fields.push({ type: "mrkdwn", text: `*PR_TITLE:*\n${pr_title}` });
}
if (pr_id) {
fields.push({ type: "mrkdwn", text: `*PR_ID:*\n${pr_id}` });
if (pr_link) {
fields.push({ type: "mrkdwn", text: `*Pull Request:*\n${pr_link}` });
}
if (commit_message) {
fields.push({
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "slack-approval",
"version": "1.1.5",
"version": "1.1.6",
"description": "",
"main": "index.js",
"scripts": {
Expand Down
10 changes: 3 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ async function run(): Promise<void> {
const runnerOS = process.env.RUNNER_OS || "";
const actor = process.env.GITHUB_ACTOR || "";
const branch = process.env.GITHUB_REF || "";
const pr_title = process.env.PR_TITLE || undefined;
const pr_id = process.env.PR_ID || undefined;
const pr_link = process.env.PR_LINK || undefined;
const commit_message = process.env.COMMIT_MESSAGE || undefined;

const sha = process.env.COMMIT_SHA || "";
Expand All @@ -36,11 +35,8 @@ async function run(): Promise<void> {
];

// Add PR details only if they exist:
if (pr_title) {
fields.push({ type: "mrkdwn", text: `*PR_TITLE:*\n${pr_title}` });
}
if (pr_id) {
fields.push({ type: "mrkdwn", text: `*PR_ID:*\n${pr_id}` });
if (pr_link) {
fields.push({ type: "mrkdwn", text: `*Pull Request:*\n${pr_link}` });
}
if (commit_message) {
fields.push({
Expand Down

0 comments on commit 8fc5a7f

Please sign in to comment.