-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/ramp-deeplink-handler
- Loading branch information
Showing
152 changed files
with
3,479 additions
and
875 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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Crowdin - Branch and Label Cleanup for merged localization PR | ||
# This action should delete the branch from Crowdin after the localization PR is | ||
# merged to the original branch. It should also remove the "ready-for-translation" label | ||
|
||
# TODO: Add trigger for merge of localization PR. | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
prestep: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
branch: ${{ steps.extract_current_branch.outputs.branch }} | ||
pr: ${{ steps.get-prs.outputs.pr }} | ||
steps: | ||
- name: Extract current branch name | ||
shell: bash | ||
run: | | ||
echo "running on branch ${GITHUB_REF##*/}" | ||
echo "other version: ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | ||
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT" | ||
id: extract_current_branch | ||
|
||
- name: Get PR with Label for this branch | ||
id: get-prs | ||
run: | | ||
LABEL="ready-for-translation" | ||
API_URL="https://api.github.com/repos/Metamask/crowdin-sandbox/pulls?head:${{steps.extract_current_branch.outputs.branch}}&state=open&per_page=100" | ||
# Fetch the list of open pull requests with the specified label using curl | ||
PRS=$(curl -sS --header "Authorization: Bearer $GITHUB_TOKEN" "$API_URL") | ||
PR=$(echo "$PRS" | jq -r '.[] | select(.labels[].name == "'"$LABEL"'") | .number | @json') | ||
echo "Found PR: $PR" | ||
echo "pr=$PR" >> "$GITHUB_OUTPUT" | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CURRENT_BRANCH: ${{ steps.extract_current_branch.outputs.branch }} | ||
|
||
github_cleanup: | ||
runs-on: ubuntu-latest | ||
needs: prestep | ||
steps: | ||
- name: Remove label from PR | ||
uses: actions/github-script@v3 | ||
if: needs.prestep.outputs.pr != null || needs.prestep.outputs.pr != '' | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const label = "ready-for-translation"; | ||
await github.issues.removeLabel({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: ${{ needs.prestep.outputs.pr }}, | ||
name: label | ||
}); | ||
crowdin_cleanup: | ||
runs-on: ubuntu-latest | ||
needs: prestep | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | ||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ needs.prestep.outputs.branch }} | ||
|
||
- name: Delete branch within Crowdin | ||
if: needs.prestep.outputs.branch != 'main' | ||
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d | ||
with: | ||
command: branch delete ${{ needs.prestep.outputs.branch }} | ||
command_args: -v |
50 changes: 50 additions & 0 deletions
50
.github/workflows/crowdin-branch-pr-ready-for-translation.yml
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,50 @@ | ||
name: Crowdin - Ready for translations label added, push to crowdin | ||
|
||
# When an individual is working on a feature which requires translations, they can | ||
# add a label "ready-for-translation" which will trigger this action to push the | ||
# source and translation files to Crowdin. We will always push main as the base of | ||
# the crowdin branch creation and then push in the changes over the top. This ensures | ||
# that the translations which have already been done and approved previously do not | ||
# show as needing to be translated again in the crowdin branch. | ||
|
||
# TODO: switch to trigger on label add once testing complete | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
crowdin-upload: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | ||
|
||
steps: | ||
- name: Extract current branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT" | ||
id: extract_current_branch | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: main | ||
|
||
- name: Crowdin push main as baseline | ||
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d | ||
with: | ||
crowdin_branch_name: ${{ steps.extract_current_branch.outputs.branch }} | ||
upload_sources: true | ||
upload_translations_args: --import-eq-suggestions --auto-approve-imported --verbose | ||
upload_translations: true | ||
|
||
- name: Checkout Branch and push to crowdin | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ steps.extract_current_branch.outputs.branch }} | ||
- name: Crowdin sources push | ||
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d | ||
with: | ||
crowdin_branch_name: ${{ steps.extract_current_branch.outputs.branch }} | ||
upload_sources: true | ||
upload_sources_args: --auto-update --verbose | ||
upload_translations: false |
63 changes: 63 additions & 0 deletions
63
.github/workflows/crowdin-pull-branch-pr-completed-translations.yml
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,63 @@ | ||
name: Crowdin - Find all branches with translations and trigger completion checks | ||
# This workflow will run on a schedule. It will pull all pull requests with a label of | ||
# ready-for-translation and create a matrix of the associated branches to run the | ||
# crowdin-reusable-translation-download.yml workflow on. | ||
# That workflow will check the status of the translations and if complete create a pull | ||
# request with the translations off of the branch. | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
# TODO: Add a schedule to run this workflow twice a day(?) once the testing is complete | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
run-check-and-download-for-branch: | ||
needs: get-branches | ||
if: ${{ needs.get-branches.outputs.matrix != '[]' && needs.get-branches.outputs.matrix != '' }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
branch: ${{fromJson(needs.get-branches.outputs.matrix)}} | ||
uses: ./.github/workflows/crowdin-reusable-translation-download.yml | ||
with: | ||
branch: ${{ matrix.branch }} | ||
secrets: | ||
gh_token: ${{ secrets.GITHUB_TOKEN }} | ||
crowdin_personal_token: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} | ||
crowdin_project_id: ${{ secrets.CROWDIN_PROJECT_ID }} | ||
|
||
get-branches: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.matrix-outputs.outputs.matrix }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get Branches with Label | ||
id: get-branches | ||
run: | | ||
GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}" | ||
LABEL="ready-for-translation" | ||
API_URL="https://api.github.com/repos/Metamask/crowdin-sandbox/pulls?state=open&per_page=100" | ||
# Fetch the list of open pull requests with the specified label using curl | ||
PRS=$(curl -sS --header "Authorization: Bearer $GITHUB_TOKEN" "$API_URL") | ||
BRANCHES=$(echo "$PRS" | jq -r '[.[] | select(.labels[].name == "'"$LABEL"'") | .head.ref] | @json') | ||
echo "Found branches: $BRANCHES" | ||
echo "branches=$BRANCHES" >> "$GITHUB_OUTPUT" | ||
- name: Set up matrix | ||
id: matrix-outputs | ||
run: | | ||
# Parse the branches output and create a matrix | ||
BRANCHES="${{ toJson(steps.get-branches.outputs.branches) }}" | ||
echo "Creating matrix from branches..." | ||
MATRIX="${BRANCHES}" | ||
echo "matrix=$MATRIX" >> "$GITHUB_OUTPUT" | ||
64 changes: 64 additions & 0 deletions
64
.github/workflows/crowdin-reusable-translation-download.yml
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,64 @@ | ||
name: Crowdin - Check translation progress and download if complete (unless main) | ||
# This is a reusable workflow that is called by crowdin-pull-branch-pr-completed-translations | ||
# across all branches which have a label of "ready-for-translation" aka being translated. | ||
# This workflow will check the translation progress and download the translations if | ||
# they are 100% translated. If the branch that is running this is main it will skip completion | ||
# check and just pull whatever translations are available. | ||
|
||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
branch: | ||
required: true | ||
type: string | ||
secrets: | ||
gh_token: | ||
required: true | ||
crowdin_project_id: | ||
required: true | ||
crowdin_personal_token: | ||
required: true | ||
|
||
jobs: | ||
crowdin: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.gh_token }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.crowdin_personal_token }} | ||
CROWDIN_PROJECT_ID: ${{ secrets.crowdin_project_id }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.branch }} | ||
|
||
- name: Check translation progress | ||
# when main just pull whatever you have (aka skip this) - need to test | ||
if: ${{ inputs.branch != 'main' }} | ||
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d | ||
with: | ||
command: 'status translation' | ||
command_args: '-b ${{ inputs.branch }} --fail-if-incomplete' | ||
|
||
- name: Synchronize with Crowdin | ||
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d | ||
with: | ||
crowdin_branch_name: ${{ inputs.branch }} | ||
upload_sources: false | ||
upload_translations: false | ||
download_translations: true | ||
skip_untranslated_strings: true | ||
export_only_approved: true | ||
localization_branch_name: l10n_crowdin_translations_${{ inputs.branch }} | ||
|
||
create_pull_request: true | ||
skip_ref_checkout: true | ||
pull_request_title: New Crowdin translations for ${{ inputs.branch }} | ||
pull_request_body: New Crowdin pull request with translations for ${{ inputs.branch }} | ||
pull_request_base_branch_name: ${{ inputs.branch }} |
31 changes: 31 additions & 0 deletions
31
.github/workflows/crowdin-upload-both-sources-translations.yml
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,31 @@ | ||
name: Crowdin - Upload Both Sources and Translations Crowdin Action | ||
# This action is intended to ensure our main branch on crowdin is in sync with our | ||
# main branch on github and will run on every push to main that has changes to any | ||
# locales files. | ||
|
||
# TODO: Change to trigger on merge to main when locales files are changed (after testing) | ||
# This should replace the current crowdin_action.yml file (after testing) | ||
on: workflow_dispatch | ||
|
||
jobs: | ||
crowdin-upload: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Extract current branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_OUTPUT" | ||
id: extract_current_branch | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Crowdin push | ||
uses: crowdin/github-action@c953b17499daa6be3e5afbf7a63616fb02d8b18d | ||
with: | ||
crowdin_branch_name: ${{ steps.extract_current_branch.outputs.branch }} | ||
upload_sources: true | ||
upload_translations: true | ||
upload_translations_args: --import-eq-suggestions --auto-approve-imported --verbose | ||
download_translations: false | ||
env: | ||
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} | ||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} |
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
1 change: 1 addition & 0 deletions
1
app/component-library/components/Badges/Badge/Badge.constants.ts
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,2 +1,3 @@ | ||
export const BADGE_BADGENETWORK_TEST_ID = 'badge-badgenetwork'; | ||
export const BADGE_BADGESTATUS_TEST_ID = 'badge-badgestatus'; | ||
export const BADGE_BADGENOTIFICATIONS_TEST_ID = 'badge-badgenotifications'; |
Oops, something went wrong.