Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

[translators] Update translators branch with master 📚 #5868

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions .github/workflows/generate-preview-link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,23 @@ jobs:
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Checkout to repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_sha }}
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow_conclusion: success
run_id: ${{ github.event.workflow_run.id }}
name: 'pr-${{ github.event.workflow_run.id }}'
path: .pr

- name: Retrieve pull request
id: pr_information
run: |
echo "issue_number=$(cat ./NR)" > $GITHUB_OUTPUT
echo "issue_number=$(cat .pr/NR)" >> $GITHUB_OUTPUT

- name: 'Generate action link comment'
id: generate_action_url
Expand Down Expand Up @@ -71,23 +76,18 @@ jobs:
user=$(cat ./USERNAME)
response=$(curl -s -L \
-w "%{http_code}" \
-o /dev/null -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/binary-com/memberships/$user")

-o /dev/null -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/binary-com/memberships/$user")
if [ $response != "200" ]; then
echo "User is not a member of binary-com organization."
exit 1
else
echo "User is a member of binary-com organization."
echo "Proceeding to build and deploy for the pull request: https://github.com/binary-com/deriv-com/pull/$(cat ./NR)"
fi
- name: Checkout to repo
uses: actions/checkout@v3
with:
ref: ${{ github.event.workflow_run.head_sha }}

- name: Setup node
uses: actions/setup-node@v2

Expand Down Expand Up @@ -135,15 +135,18 @@ jobs:
projectName='deriv-com-preview-links'
head_branch=${{github.event.workflow_run.head_branch}}
branch=$(echo $head_branch | head -c 20 | sed 's/[\/_\.]/-/g; s/[^a-zA-Z0-9]$/1/')
preview_url=$(wrangler pages deploy $directory --project-name=$projectName --branch=$branch > log.txt 2>&1; echo $?)
cf_preview_url=$(wrangler pages deploy $directory --project-name=$projectName --branch=$branch > log.txt 2>&1; echo $?)
echo "------"
preview_url=https://$branch.deriv-com-preview-links.pages.dev
cat log.txt
if grep -q "Deployment complete" log.txt; then
echo "preview_url=https://$branch.deriv-com-preview-links.pages.dev" > "$GITHUB_OUTPUT"
echo "preview_url=$preview_url" >> "$GITHUB_OUTPUT"
echo $preview_url > .pr/PREVIEW_URL
else
echo "Deployment to Cloudflare Pages failed."
exit 1
fi

- name: 'Generate preview link comment'
if: success()
id: generate_preview_url
Expand Down Expand Up @@ -187,3 +190,9 @@ jobs:
number: ${{steps.pr_information.outputs.issue_number}}
message: ${{steps.generate_preview_url.outputs.comment || steps.generate_failure_comment.outputs.comment }}
recreate: true

- name: Upload PR information to artifact
uses: actions/upload-artifact@v2
with:
name: 'pr-${{github.run_id}}'
path: .pr
186 changes: 99 additions & 87 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,56 @@
name: Deriv Lighthouse 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:
issue_comment:
types: [edited]
workflow_run:
workflows: ['Generate preview link']
types:
- completed

jobs:
generate_lighthouse_audit:
timeout-minutes: 30
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow_conclusion: success
run_id: ${{ github.event.workflow_run.id }}
name: 'pr-${{ github.event.workflow_run.id }}'
path: pr

- name: Retrieve pull request
id: pr_information
run: |
echo "issue_number=$(cat ./pr/NR)" >> $GITHUB_OUTPUT
echo "preview_url=$(cat ./pr/PREVIEW_URL)" >> $GITHUB_OUTPUT

- name: Add comment to PR
id: loading_comment_to_pr
uses: marocchino/sticky-pull-request-comment@v2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
number: ${{ github.event.issue.number }}
number: ${{ steps.pr_information.outputs.issue_number }}
header: lighthouse
message: |
Running Lighthouse audit...
- name: Capture Vercel preview URL
id: vercel_preview_url
uses: binary-com/[email protected]
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
- name: Audit preview URL with Lighthouse
id: lighthouse_audit
uses: treosh/lighthouse-ci-action@v9
with:
urls: |
${{ steps.vercel_preview_url.outputs.vercel_preview_url }}
${{ steps.pr_information.outputs.preview_url }}
uploadArtifacts: true
temporaryPublicStorage: true
runs: 5
Expand Down Expand Up @@ -83,7 +96,6 @@ jobs:
core.setOutput("best_practices_color", score(result['best-practices']));
core.setOutput("full_report", full_report);


- name: Add comment to PR
id: comment_to_pr
uses: marocchino/sticky-pull-request-comment@v2
Expand All @@ -100,83 +112,83 @@ jobs:
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 performance score."
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ steps.format_lighthouse_score.outputs.performance_color }} PERFORMANCE:* ${{ steps.format_lighthouse_score.outputs.performance }}\n\n*${{ steps.format_lighthouse_score.outputs.accessibility_color }} ACCESSIBILITY:* ${{ steps.format_lighthouse_score.outputs.accessibility }}\n\n*${{ steps.format_lighthouse_score.outputs.best_practices_color }} BEST PRACTICES:* ${{ steps.format_lighthouse_score.outputs.best_practices }}\n\n*${{ steps.format_lighthouse_score.outputs.seo_color }} SEO:* ${{ steps.format_lighthouse_score.outputs.seo }} \n\n*${{ steps.format_lighthouse_score.outputs.pwa_color }} PWA:* ${{ steps.format_lighthouse_score.outputs.pwa }}"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*User: <${{ github.event.issue.user.url }}|${{ github.event.issue.user.login }}>*\n*Link:* ${{ github.event.issue.pull_request.html_url }}\n*Title:* ${{ github.event.issue.title }}\n*Status:* ${{ github.event.issue.state }}"
{
"blocks": [
{
"type": "section",
"text": {
"type": "plain_text",
"emoji": true,
"text": "It appears that this pull request has not met the required performance score."
}
},
"accessory": {
"type": "image",
"image_url": "${{ github.event.issue.user.avatar_url }}",
"alt_text": "${{ github.event.issue.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": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*<!subteam^S04RV6RFCTW> please check the PR*"
"text": "*${{ steps.format_lighthouse_score.outputs.performance_color }} PERFORMANCE:* ${{ steps.format_lighthouse_score.outputs.performance }}\n\n*${{ steps.format_lighthouse_score.outputs.accessibility_color }} ACCESSIBILITY:* ${{ steps.format_lighthouse_score.outputs.accessibility }}\n\n*${{ steps.format_lighthouse_score.outputs.best_practices_color }} BEST PRACTICES:* ${{ steps.format_lighthouse_score.outputs.best_practices }}\n\n*${{ steps.format_lighthouse_score.outputs.seo_color }} SEO:* ${{ steps.format_lighthouse_score.outputs.seo }} \n\n*${{ steps.format_lighthouse_score.outputs.pwa_color }} PWA:* ${{ steps.format_lighthouse_score.outputs.pwa }}"
}
]
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Want the full lighthouse report?"
},
"accessory": {
"type": "button",
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "View",
"emoji": true
"type": "mrkdwn",
"text": "*User: <${{ github.event.issue.user.url }}|${{ github.event.issue.user.login }}>*\n*Link:* ${{ github.event.issue.pull_request.html_url }}\n*Title:* ${{ github.event.issue.title }}\n*Status:* ${{ github.event.issue.state }}"
},
"value": "click_me_123",
"url": "${{ steps.format_lighthouse_score.outputs.full_report }}",
"action_id": "button-action"
"accessory": {
"type": "image",
"image_url": "${{ github.event.issue.user.avatar_url }}",
"alt_text": "${{ github.event.issue.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*"
}
]
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Want the full lighthouse report?"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "View",
"emoji": true
},
"value": "click_me_123",
"url": "${{ steps.format_lighthouse_score.outputs.full_report }}",
"action_id": "button-action"
}
},
{
"type": "divider"
}
},
{
"type": "divider"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_LIGHTHOUSE }}
Loading
Loading