Skip to content

Commit

Permalink
feat: add getTranslationProgress github action
Browse files Browse the repository at this point in the history
commit first data fetch of translation progress
  • Loading branch information
wackerow committed Jan 24, 2024
1 parent d38f027 commit cc8b5cb
Show file tree
Hide file tree
Showing 3 changed files with 553 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/get-translation-progress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Update Crowdin translation progression

on:
schedule:
- cron: "20 16 * * FRI"
workflow_dispatch:

jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- 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 "[email protected]"
git config --global user.name "GitHub Action"
- name: Generate timestamp and readable date
id: date
run: |
echo "TIMESTAMP=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
echo "READABLE_DATE=$(date +'%B %-d')" >> $GITHUB_ENV
- name: Fetch latest dev and create new branch
run: |
git fetch origin dev
git checkout -b "automated-update-${{ env.TIMESTAMP }}" origin/dev
- name: Run script
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/getTranslationProgress.ts
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}

- name: Commit and push
run: |
git add -A
git commit -m "Update Crowdin translation progress"
git push origin "automated-update-${{ env.TIMESTAMP }}"
- name: Create PR body
run: |
echo "This PR was automatically created to update Crowdin translation progress." > pr_body.txt
echo "This workflows runs every Friday at 16:20 (UTC)." >> pr_body.txt
echo "" >> pr_body.txt
echo "Thank you to everyone contributing to translate ethereum.org ❤️" >> pr_body.txt
- name: Create Pull Request
run: |
gh auth login --with-token <<< ${{ secrets.GITHUB_TOKEN }}
gh pr create --base dev --head "automated-update-${{ env.TIMESTAMP }}" --title "Update translation progress from Crowdin - ${{ env.READABLE_DATE }}" --body-file pr_body.txt
Loading

0 comments on commit cc8b5cb

Please sign in to comment.