This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: added github readonly token to actions (#6085)
- Loading branch information
1 parent
814175c
commit a6bfb0f
Showing
7 changed files
with
185 additions
and
130 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
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 |
---|---|---|
@@ -1,111 +1,118 @@ | ||
name: Core Web Vitals Audit | ||
|
||
permissions: | ||
actions: write | ||
checks: write | ||
contents: write | ||
deployments: write | ||
pull-requests: write | ||
statuses: write | ||
actions: write | ||
checks: write | ||
contents: write | ||
deployments: write | ||
pull-requests: write | ||
statuses: write | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
core_web_vitals_audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
core_web_vitals_audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
- name: Create npmrc file | ||
shell: bash | ||
run: echo "@deriv-com:registry=https://npm.pkg.github.com" >> .npmrc | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
- name: Setup install read-only token for deriv-com org | ||
shell: bash | ||
run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.READ_DERIV_COM_ORG_PACKAGES }}' >> .npmrc | ||
|
||
- name: Run Core Web Vitals Audit | ||
run: npm run audit | ||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Install Datadog CI | ||
run: npm install -g @datadog/datadog-ci | ||
- name: Run Core Web Vitals Audit | ||
run: npm run audit | ||
|
||
- name: Sync results with Datadog | ||
run: | | ||
datadog-ci synthetics upload --config datadog-ci.json | ||
datadog-ci synthetics results --config datadog-ci.json > results.json | ||
env: | ||
DATADOG_API_KEY: ${{ secrets.GATSBY_DATADOG_CLIENT_TOKEN }} | ||
DATADOG_APP_KEY: ${{ secrets.GATSBY_DATADOG_APPLICATION_ID }} | ||
|
||
- name: Post audit comment | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
header: Core Web Vitals Audit | ||
message: | | ||
### Core Web Vitals Results | ||
- Largest Contentful Paint: ${{ steps.results.outputs.lcp }} | ||
- First Input Delay: ${{ steps.results.outputs.fid }} | ||
- Cumulative Layout Shift: ${{ steps.results.outputs.cls }} | ||
- name: Slack Notification 📣 | ||
uses: 8398a7/action-slack@v3 | ||
if: ${{ failure() }} | ||
with: | ||
status: custom | ||
fields: workflow,job,commit,repo | ||
custom_payload: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "plain_text", | ||
"emoji": true, | ||
"text": "It appears that this pull request has not met the required Core Web Vitals score." | ||
} | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*User: <${{ github.event.pull_request.user.url }}|${{ github.event.pull_request.user.login }}>*\n*Link:* ${{ github.event.pull_request.html_url }}\n*Title:* ${{ github.event.pull_request.title }}\n*Status:* ${{ github.event.pull_request.state }}" | ||
}, | ||
"accessory": { | ||
"type": "image", | ||
"image_url": "${{ github.event.pull_request.user.avatar_url }}", | ||
"alt_text": "${{ github.event.pull_request.user.login }}" | ||
} | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "image", | ||
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/notificationsWarningIcon.png", | ||
"alt_text": "notifications warning icon" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*<!subteam^S04RV6RFCTW> please check the PR*" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
- name: Install Datadog CI | ||
run: npm install -g @datadog/datadog-ci | ||
|
||
- name: Sync results with Datadog | ||
run: | | ||
datadog-ci synthetics upload --config datadog-ci.json | ||
datadog-ci synthetics results --config datadog-ci.json > results.json | ||
env: | ||
DATADOG_API_KEY: ${{ secrets.GATSBY_DATADOG_CLIENT_TOKEN }} | ||
DATADOG_APP_KEY: ${{ secrets.GATSBY_DATADOG_APPLICATION_ID }} | ||
|
||
- name: Post audit comment | ||
uses: marocchino/sticky-pull-request-comment@v2 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
header: Core Web Vitals Audit | ||
message: | | ||
### Core Web Vitals Results | ||
- Largest Contentful Paint: ${{ steps.results.outputs.lcp }} | ||
- First Input Delay: ${{ steps.results.outputs.fid }} | ||
- Cumulative Layout Shift: ${{ steps.results.outputs.cls }} | ||
- name: Slack Notification 📣 | ||
uses: 8398a7/action-slack@v3 | ||
if: ${{ failure() }} | ||
with: | ||
status: custom | ||
fields: workflow,job,commit,repo | ||
custom_payload: | | ||
{ | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "plain_text", | ||
"emoji": true, | ||
"text": "It appears that this pull request has not met the required Core Web Vitals score." | ||
} | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*User: <${{ github.event.pull_request.user.url }}|${{ github.event.pull_request.user.login }}>*\n*Link:* ${{ github.event.pull_request.html_url }}\n*Title:* ${{ github.event.pull_request.title }}\n*Status:* ${{ github.event.pull_request.state }}" | ||
}, | ||
"accessory": { | ||
"type": "image", | ||
"image_url": "${{ github.event.pull_request.user.avatar_url }}", | ||
"alt_text": "${{ github.event.pull_request.user.login }}" | ||
} | ||
}, | ||
{ | ||
"type": "divider" | ||
}, | ||
{ | ||
"type": "context", | ||
"elements": [ | ||
{ | ||
"type": "image", | ||
"image_url": "https://api.slack.com/img/blocks/bkb_template_images/notificationsWarningIcon.png", | ||
"alt_text": "notifications warning icon" | ||
}, | ||
{ | ||
"type": "mrkdwn", | ||
"text": "*<!subteam^S04RV6RFCTW> please check the PR*" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
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
Oops, something went wrong.
a6bfb0f
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.
Successfully deployed to the following URLs:
deriv-com – ./
deriv-com.binary.sx
deriv-com-git-master.binary.sx