Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into refactor/update-existi…
Browse files Browse the repository at this point in the history
…ng-stories
  • Loading branch information
TylerAPfledderer committed Jun 1, 2024
2 parents 6f9a3de + bae037f commit a5dd229
Show file tree
Hide file tree
Showing 130 changed files with 2,525 additions and 1,586 deletions.
72 changes: 72 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -12042,6 +12042,78 @@
"contributions": [
"doc"
]
},
{
"login": "woxjro",
"name": "woxjro",
"avatar_url": "https://avatars.githubusercontent.com/u/63214188?v=4",
"profile": "https://github.com/woxjro",
"contributions": [
"tool"
]
},
{
"login": "SeanXLChen",
"name": "bambooskySean",
"avatar_url": "https://avatars.githubusercontent.com/u/78134555?v=4",
"profile": "https://github.com/SeanXLChen",
"contributions": [
"code"
]
},
{
"login": "VikVM",
"name": "VikVM",
"avatar_url": "https://avatars.githubusercontent.com/u/60881781?v=4",
"profile": "https://github.com/VikVM",
"contributions": [
"content"
]
},
{
"login": "checkomkar",
"name": "Omkar Kamale",
"avatar_url": "https://avatars.githubusercontent.com/u/8987373?v=4",
"profile": "https://github.com/checkomkar",
"contributions": [
"code"
]
},
{
"login": "mingoing",
"name": "Mingo",
"avatar_url": "https://avatars.githubusercontent.com/u/344175?v=4",
"profile": "https://github.com/mingoing",
"contributions": [
"doc"
]
},
{
"login": "zkVlad",
"name": "zkVlad",
"avatar_url": "https://avatars.githubusercontent.com/u/125317045?v=4",
"profile": "https://github.com/zkVlad",
"contributions": [
"doc"
]
},
{
"login": "yunseonna",
"name": "yunseon na",
"avatar_url": "https://avatars.githubusercontent.com/u/148749864?v=4",
"profile": "https://github.com/yunseonna",
"contributions": [
"doc"
]
},
{
"login": "alex1092",
"name": "Alex",
"avatar_url": "https://avatars.githubusercontent.com/u/59183749?v=4",
"profile": "https://github.com/alex1092",
"contributions": [
"code"
]
}
],
"contributorsPerLine": 7,
Expand Down
20 changes: 8 additions & 12 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
"needs review 👀":
- src/**/*
- public/*

"documentation 📖":
- README.md
- docs/**/*

"tooling 🔧":
- .github/**/*
- src/scripts/*
- src/lib/*
- src/hooks/*
- src/scripts/**/*
- src/lib/**/*
- src/hooks/**/*
- .storybook/**/*

"dependencies 📦":
- package.json
- yarn.lock

"internal 🏠":
- .all-contributorsrc
"config ⚙️":
- i18n.config.json
- next.config.js
- next-i18next.config,js
Expand All @@ -30,12 +27,11 @@
- netlify.toml

"translation 🌍":
- src/content/translations/**/*
- public/content/translations/**/*
- src/intl/**/*
- src/lib/utils/translations.ts

"content 🖋️":
- src/pages/*
- src/intl/en/**
- public/content/**/*

"event 📅":
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/build-crowdin.yml

This file was deleted.

68 changes: 68 additions & 0 deletions .github/workflows/crowdin-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Crowdin CI

on:
schedule:
- cron: "20 4 1 * *" # Runs at 4:20 AM on the first day of every month
workflow_dispatch: # Can be dispatched manually

jobs:
create_approved_language_bucket_prs:
runs-on: ubuntu-latest
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
# Set up environment
- name: Check out code
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: yarn install

- name: Install ts-node
run: yarn global add ts-node

- name: Set up git
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Action"
- name: Fetch latest dev
run: git fetch origin dev

# Build translations
- name: Build Crowdin project
id: build-crowdin
run: |
npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/triggerBuild.ts;
grep BUILD_ID output.env >> $GITHUB_ENV;
- name: Await latest build to finish
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/awaitLatestBuild.ts

- name: Check build success
run: |
if [ $(grep BUILD_SUCCESS output.env | cut -d'=' -f2) = false ]; then
echo "Build timed out, exiting"
exit 1
fi
shell: bash

# Prepare bucket ids
- name: Get latest translation bucket directory ids
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/getBucketDirectoryIds.ts

# Import approved translations
- name: Get translations
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/getTranslations.ts

# Post updates as language-specific PRs
- name: Process commits and post PRs by language
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/postLangPRs.ts
47 changes: 0 additions & 47 deletions .github/workflows/get-translations.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,26 @@ jobs:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

- name: Refine labels
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
try {
const { owner, repo, number: pull_number } = context.issue;
const { data: files } = await github.pulls.listFiles({ owner, repo, pull_number });
const allInEn = files.every(file => file.filename.startsWith('src/intl/en/'));
const allInTranslations = files.every(file => file.filename.startsWith('public/content/translations/'));
if (allInEn) {
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'translation 🌍' });
}
if (allInTranslations) {
await github.issues.removeLabel({ owner, repo, issue_number: pull_number, name: 'content 🖋️' });
}
} catch (error) {
console.warn("Problem occurred refining labels")
}
44 changes: 23 additions & 21 deletions .github/workflows/non-english-warning.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,34 @@ on:
paths:
- "public/content/translations/**/*.md"
- "src/intl/**/*.json"
- "!src/intl/en/**
- "!src/intl/en/**"

jobs:
check_branch_name:
check_and_label:
runs-on: ubuntu-latest
steps:
- name: Exit early if branch name contains 'crowdin'
- name: Exit early if branch name contains 'crowdin' or is 'dev', 'staging', or 'master'
id: check_branch
run: |
if [[ "${{ github.head_ref }}" == *crowdin* ]]; then
echo "Branch name contains 'crowdin', stopping workflow"
exit 1
if [[ "${{ github.head_ref }}" == *crowdin* ]] ||
[[ "${{ github.ref }}" == 'refs/heads/dev' ]] ||
[[ "${{ github.ref }}" == 'refs/heads/staging' ]] ||
[[ "${{ github.ref }}" == 'refs/heads/master' ]]
then
echo "Branch name contains 'crowdin' or is 'dev', 'staging', or 'master', stopping workflow"
echo "::set-output name=skip::true"
exit 0
else
echo "::set-output name=skip::false"
fi
check_changes:
needs: check_branch_name
runs-on: ubuntu-latest
outputs:
all_changes_include_href: ${{ steps.check.outputs.all_changes_include_href }}
steps:
- name: Checkout code
if: steps.check_branch.outputs.skip == 'false'
uses: actions/checkout@v2

- name: Check changes
id: check
if: steps.check_branch.outputs.skip == 'false'
id: check_changes
run: |
git fetch origin ${{ github.base_ref }}
DIFF=$(git diff --no-ext-diff --unified=0 origin/${{ github.base_ref }}..${{ github.head_ref }} -- 'public/content/translations/**/*.md' 'src/intl/**/*.json' '!src/intl/en/**' | grep -E -v '^[-+]href=')
Expand All @@ -38,27 +43,24 @@ jobs:
fi
echo "::set-output name=all_changes_include_href::$ALL_CHANGES_INCLUDE_HREF"
add_label_and_comment:
needs: check_changes
runs-on: ubuntu-latest
steps:
- name: Add label and comment
if: steps.check_branch.outputs.skip == 'false'
uses: actions/github-script@v5
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const prNumber = context.issue.number;
const repo = context.repo;
const prAuthor = context.payload.pull_request.user.login;
const allChangesIncludeHref = '${{ needs.check_changes.outputs.all_changes_include_href }}' === 'true';
const status = allChangesIncludeHref ? 'question ❓' : 'blocked 🛑';
const allChangesIncludeHref = '${{ steps.check_changes.outputs.all_changes_include_href }}' === 'true';
const status = allChangesIncludeHref ? 'question ❓' : 'Status: Blocked 🛑';
await github.rest.issues.addLabels({
...repo,
issue_number: prNumber,
labels: [status, 'non-crowdin translation updates']
});
const commentWithoutHrefs = `This pull request contains changes to non-English content, which must also be handled through the Crowdin platform instead of only on GitHub.`
const commentWithHrefs = `This pull request contains changes to non-English content files, which may also need to be handled through the Crowdin platform instead of only on GitHub.
const commentWithHrefs = `This pull request contains changes to non-English content files, which may also need to be handled through the Crowdin platform instead of only on GitHub.`
await github.rest.issues.createComment({
...repo,
issue_number: prNumber,
Expand All @@ -71,4 +73,4 @@ jobs:
Please post here or join [our Discord](https://ethereum.org/discord) if you have questions!
`
});
});
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ robots.txt
# .crowdin folder used as temp forlder for crowdin-import script
.crowdin

# vscode workplace configuration
# workplace configuration
.vscode
.idea

# Crowdin report output
src/data/crowdin/bucketsAwaitingReviewReport.csv
src/data/crowdin/bucketsAwaitingReviewReport.csv
Loading

0 comments on commit a5dd229

Please sign in to comment.