Skip to content

Commit

Permalink
Merge pull request #27 from sivasadobe/stage
Browse files Browse the repository at this point in the history
fix: secret var fix
  • Loading branch information
sivasadobe authored Jul 2, 2024
2 parents 098a289 + 6de3d0b commit 4857d31
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -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
GITHUB_REPOSITORY=adobecom/cc
6 changes: 6 additions & 0 deletions .github/workflows/merged-to-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,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
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/src/send-slack.js
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down Expand Up @@ -46,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
Expand All @@ -58,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);
Expand Down

0 comments on commit 4857d31

Please sign in to comment.