generated from adobe/aem-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* High Impact Alert Workflow * [MWPW-148268] Update workflow conditional
- Loading branch information
1 parent
62c25ff
commit 29d0a16
Showing
6 changed files
with
60 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const { | ||
Check warning on line 1 in .github/workflows/high-impact-alert.js GitHub Actions / Running eslint
|
||
slackNotification, | ||
getLocalConfigs, | ||
} = require('./helpers.js'); | ||
|
||
const main = async (params) => { | ||
const { context } = params; | ||
|
||
try { | ||
if (context.payload.label.name !== 'high-impact') { | ||
console.log('No high impact label detected'); | ||
return; | ||
} | ||
|
||
const { html_url, number, title } = context.payload.pull_request; | ||
console.log('High impact label detected, sending Slack notification'); | ||
slackNotification(`:alert: High Impact PR has been opened: <${html_url}|#${number}: ${title}>.` + | ||
` Please prioritize testing the proposed changes.`, process.env.SLACK_HIGH_IMPACT_PR_WEBHOOK); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}; | ||
|
||
if (process.env.LOCAL_RUN) { | ||
const { context } = getLocalConfigs(); | ||
main({ context }); | ||
} | ||
|
||
module.exports = main; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: High Impact Alert | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- labeled | ||
|
||
env: | ||
SLACK_HIGH_IMPACT_PR_WEBHOOK: ${{ secrets.SLACK_HIGH_IMPACT_PR_WEBHOOK }} | ||
|
||
jobs: | ||
send_alert: | ||
if: github.repository_owner == 'adobecom' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4.1.4 | ||
|
||
- name: Send Slack message for high impact PRs | ||
uses: actions/github-script@v7.0.1 | ||
with: | ||
script: | | ||
const main = require('./.github/workflows/high-impact-alert.js') | ||
main({ github, context }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ on: | |
|
||
jobs: | ||
update: | ||
if: github.repository_owner == 'adobecom' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|