-
Notifications
You must be signed in to change notification settings - Fork 0
Mokimo milo stage #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9a311f3
c5e7bdb
205a539
80c9970
d29d1fa
8a42c76
32b0ff7
9e331ff
ebfe151
f6ed5dd
bfcf4de
8b31f36
b1d99d6
212012d
c7c3990
a357093
d98fe88
79556b7
5307425
609e09e
d7014b4
430af0e
79058c7
31ab20d
d9df978
548cf48
bf86d96
65aa902
c8e72b6
0197780
bc66db6
bb0a591
7bfe86a
b5d215a
aa06832
f1bba95
d7f3d4e
18f641f
724c9cd
4dccbf8
e6133e2
4db3512
827c334
c2ed5ea
9b4ae62
e536bf6
8e7c30b
4499567
42ad2af
7f7b789
ff4e0bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ### Description | ||
| Based on the [Github security guidance](https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#using-third-party-actions) we pinned actions to a full length commit SHA's rather than tags, which are more common. | ||
| In order to upgrade an action, simply go to the Github repo such as: https://github.com/actions/checkout/releases - find the latest release and the commit-SHA that is connected to it and replace it for all actions that use the 3rd party package you want to upgrade. This [PR](https://github.com/adobecom/milo/pull/3830) serves as an example where we upgraded multiple 3rd party packages across all actions. | ||
|
|
||
| To QA the change, when you run the action on your own fork, you can simply validate it's still running as expected and manages to download the 3rd party package within the scope of the action. |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| const { slackNotification, getLocalConfigs } = require('./helpers.js'); | ||
|
|
||
| async function main({ github, context } = {}) { | ||
| if (!github || !context) { | ||
| throw new Error("GitHub context is missing. Ensure you are running in the correct environment."); | ||
| } | ||
|
|
||
| if (process.env.LOCAL_RUN) { | ||
| console.log("Local run detected. Loading local configurations..."); | ||
| const localConfigs = getLocalConfigs(); | ||
| github = localConfigs.github; | ||
| context = localConfigs.context; | ||
| } | ||
|
|
||
| const { pull_request } = context.payload; | ||
| if (!pull_request) { | ||
| console.log("No pull_request found in context payload. Skipping notification."); | ||
| return; | ||
| } | ||
|
|
||
| const { number, title, html_url, base } = pull_request; | ||
| const isStage = base.ref === 'stage'; | ||
| const prefix = isStage | ||
| ? ':merged: PR merged to stage:' | ||
| : ':rocket: Production release:'; | ||
|
|
||
| console.log(`Sending notification for PR #${number}: ${title}`); | ||
|
|
||
| await slackNotification( | ||
| `${prefix} <${html_url}|#${number}: ${title}>.`, | ||
| process.env.MILO_RELEASE_SLACK_WH | ||
| ); | ||
| } | ||
|
|
||
| if (process.env.LOCAL_RUN) { | ||
| const { github, context } = getLocalConfigs(); | ||
| main({ github, context }); | ||
| } | ||
|
|
||
| module.exports = main; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: Slack notification on Merge | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: | ||
| - closed | ||
|
|
||
| jobs: | ||
| if_merged: | ||
| if: ${{ github.event.pull_request.merged == true && (github.event.pull_request.base.ref == 'stage' || github.event.pull_request.base.ref == 'main') }} | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
|
|
||
| - name: Run Notify Merge with GitHub Script | ||
| uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea | ||
| with: | ||
| script: | | ||
| const notifyMerge = require('./.github/workflows/pr-merge-notification.js'); | ||
| await notifyMerge({ github, context }); | ||
| env: | ||
| MILO_RELEASE_SLACK_WH: ${{ secrets.MILO_RELEASE_SLACK_WH }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File ignored by default. Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override.