From 28fd9a16c576daca0a5fdc45c4c4866c5428bdae Mon Sep 17 00:00:00 2001 From: sivasadobe Date: Tue, 2 Jul 2024 20:27:35 +0530 Subject: [PATCH 1/4] fix: secret var fix --- .github/workflows/merged-to-main.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/merged-to-main.yaml b/.github/workflows/merged-to-main.yaml index daaa10c..63db886 100644 --- a/.github/workflows/merged-to-main.yaml +++ b/.github/workflows/merged-to-main.yaml @@ -33,6 +33,9 @@ jobs: # Checkout repository action - name: Checkout repository uses: actions/checkout@v4 + - name: Install Octakit + run: | + npm i -D @octokit/rest # Sending release notes to cc-changelog channel - name: Sending Release Notes to cc-changelog slack channel uses: actions/github-script@v7 From 691efbdb484fa2fe55f0fbe88094547d9bf59997 Mon Sep 17 00:00:00 2001 From: sivasadobe Date: Tue, 2 Jul 2024 20:39:29 +0530 Subject: [PATCH 2/4] fix: env fix --- .env.example | 3 +-- .github/workflows/src/send-slack.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/.env.example b/.env.example index 992a137..3527f48 100644 --- a/.env.example +++ b/.env.example @@ -1,4 +1,3 @@ GH_TOKEN=https://github.com/settings/tokens?type=beta->generate_new_one SLACK_WH_URL=https://api.slack.com/messaging/webhooks->generate_new_webhook_url -REPO_OWNER=adobecom -REPO_NAME=cc \ No newline at end of file +GITHUB_REPOSITORY=adobecom/cc \ No newline at end of file diff --git a/.github/workflows/src/send-slack.js b/.github/workflows/src/send-slack.js index 52289d5..b574ba2 100644 --- a/.github/workflows/src/send-slack.js +++ b/.github/workflows/src/send-slack.js @@ -1,8 +1,7 @@ const { parseTextToSlackBlocks } = require("./helpers"); // Those env variables are set by an github action automatically -const owner = process.env.REPO_OWNER || ""; -const repo = process.env.REPO_NAME || ""; +const [owner, repo]=process.env.GITHUB_REPOSITORY?.split('/') || ''; const auth = process.env.GH_TOKEN; /** From 5ecadd864594dcc3975ffa7a0cd492fea95a5539 Mon Sep 17 00:00:00 2001 From: sivasadobe Date: Tue, 2 Jul 2024 20:44:00 +0530 Subject: [PATCH 3/4] fix --- .github/workflows/src/send-slack.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/src/send-slack.js b/.github/workflows/src/send-slack.js index b574ba2..c9a95ee 100644 --- a/.github/workflows/src/send-slack.js +++ b/.github/workflows/src/send-slack.js @@ -45,7 +45,6 @@ const sendReleaseNotes = async (prNumber, slackWebHookURL) => { const slackBodyBlocks = { blocks: [...titleBlocks, ...formattedBodyBlocks], }; - console.log("PR Number", prNumber); console.log("Message", slackBodyBlocks); // Send message to Slack webhook @@ -57,6 +56,9 @@ const sendReleaseNotes = async (prNumber, slackWebHookURL) => { }, }).catch(console.error); if (result.status === 200) console.log("Slack Message sent"); + else { + console.log(`Slack Message not sent ${result.status}:${result.statusText}`) + } return result; } catch (e) { console.log(e); From 6de3d0b5c7ec9647974ce974221e68cba31fffeb Mon Sep 17 00:00:00 2001 From: sivasadobe Date: Tue, 2 Jul 2024 20:46:07 +0530 Subject: [PATCH 4/4] fix --- .github/workflows/merged-to-main.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/merged-to-main.yaml b/.github/workflows/merged-to-main.yaml index 63db886..7c8a6ff 100644 --- a/.github/workflows/merged-to-main.yaml +++ b/.github/workflows/merged-to-main.yaml @@ -53,6 +53,9 @@ jobs: # Checkout repository action - name: Check repository uses: actions/checkout@v4 + - name: Install Octakit + run: | + npm i -D @octokit/rest # Sending release notes to cc-changelog channel - name: Sending Release Notes to cc-changelog slack channel uses: actions/github-script@v7