forked from ethereum/ethereum-org-website
-
Notifications
You must be signed in to change notification settings - Fork 1
63 lines (51 loc) · 2.04 KB
/
get-crowdin-contributors.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Update Crowdin Contributors
on:
schedule:
- cron: "0 0 * * SUN" # Runs every Sunday at midnight
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/getCrowdinContributors.ts
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
- name: Commit and push
run: |
git add -A
git commit -m "Update Crowdin contributors"
git push origin "automated-update-${{ env.TIMESTAMP }}"
- name: Create PR body
run: |
echo "This PR was automatically created to update Crowdin contributors." > pr_body.txt
echo "This workflows runs every Sunday at 00:00 (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 contributors from Crowdin - ${{ env.READABLE_DATE }}" --body-file pr_body.txt