1- name : Get Crowdin Contributors
1+ name : Update Crowdin Contributors
22
33on :
44 schedule :
5- - cron : " 0 * * * * " # Runs every day at midnight
5+ - cron : " 0 0 * * SUN " # Runs every Sunday at midnight
66 workflow_dispatch :
77
88jobs :
99 create_pr :
1010 runs-on : ubuntu-latest
11-
1211 steps :
1312 - name : Check out code
1413 uses : actions/checkout@v3
@@ -23,25 +22,42 @@ jobs:
2322
2423 - name : Install ts-node
2524 run : yarn global add ts-node
26-
27- - name : Run script
28- run : ts-node ./src/scripts/crowdin/getCrowdinContributors.ts
29-
25+
3026 - name : Set up git
3127 run : |
3228 git config --global user.email "[email protected] " 3329 git config --global user.name "GitHub Action"
3430
31+ - name : Generate timestamp and readable date
32+ id : date
33+ run : |
34+ echo "TIMESTAMP=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV
35+ echo "READABLE_DATE=$(date +'%B %-d')" >> $GITHUB_ENV
36+
37+ - name : Fetch latest dev and create new branch
38+ run : |
39+ git fetch origin dev
40+ git checkout -b "automated-update-${{ env.TIMESTAMP }}" origin/dev
41+
42+ - name : Run script
43+ run : npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/getCrowdinContributors.ts
44+ env :
45+ CROWDIN_API_KEY : ${{ secrets.CROWDIN_API_KEY }}
46+
3547 - name : Commit and push
3648 run : |
3749 git add -A
38- git commit -m "Automated update"
39- git push
50+ git commit -m "Update Crowdin contributors"
51+ git push origin "automated-update-${{ env.TIMESTAMP }}"
52+
53+ - name : Create PR body
54+ run : |
55+ echo "This PR was automatically created to update Crowdin contributors." > pr_body.txt
56+ echo "This workflows runs every Sunday at 00:00 (UTC)." >> pr_body.txt
57+ echo "" >> pr_body.txt
58+ echo "Thank you to everyone contributing to translate ethereum.org ❤️" >> pr_body.txt
4059
4160 - name : Create Pull Request
42- uses : peter-evans/create-pull-request@v3
43- with :
44- token : ${{ secrets.GITHUB_TOKEN }}
45- branch : automated-update
46- title : Automated update
47- body : This is an automated update.
61+ run : |
62+ gh auth login --with-token <<< ${{ secrets.GITHUB_TOKEN }}
63+ gh pr create --base dev --head "automated-update-${{ env.TIMESTAMP }}" --title "Update translation contributors from Crowdin - ${{ env.READABLE_DATE }}" --body-file pr_body.txt
0 commit comments