|
17 | 17 | timeout-minutes: 50 |
18 | 18 | runs-on: ubuntu-latest |
19 | 19 | steps: |
20 | | - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 20 | + - uses: actions/checkout@v6 |
21 | 21 | with: |
22 | 22 | token: ${{ secrets.MACHINE_ACCOUNT_PAT }} |
23 | 23 | ref: 'main' |
|
45 | 45 |
|
46 | 46 | - name: Calculate seconds passed |
47 | 47 | id: calc_time |
48 | | - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| 48 | + uses: actions/github-script@v8 |
49 | 49 | with: |
50 | 50 | script: | |
51 | 51 | const lastRun = new Date(process.env.LATEST_RUN); |
|
58 | 58 | if: steps.calc_time.outputs.time_left > 0 |
59 | 59 | run: sleep ${{ steps.calc_time.outputs.time_left }} |
60 | 60 |
|
61 | | - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 |
| 61 | + - uses: actions/setup-node@v6 |
62 | 62 | with: |
63 | 63 | node-version: 20 |
64 | 64 |
|
@@ -88,28 +88,30 @@ jobs: |
88 | 88 | cd ./tools/localization |
89 | 89 | yarn start update |
90 | 90 | |
91 | | - - name: Commit changes |
| 91 | + - name: Check for changes |
| 92 | + id: tr_check |
92 | 93 | run: | |
93 | 94 | git add docs/marketing/localized_description AnkiDroid/src/main/res |
94 | | - git commit -am 'Updated strings from Crowdin' |
| 95 | + if git diff --cached --quiet; then |
| 96 | + echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT |
| 97 | + else |
| 98 | + echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT |
| 99 | + fi |
| 100 | +
|
| 101 | + - name: Commit and Push changes |
| 102 | + if: steps.tr_check.outputs.HAS_CHANGES == 'true' |
| 103 | + run: | |
| 104 | + git commit -m 'Updated strings from Crowdin' |
95 | 105 | git push --set-upstream origin +i18n_sync |
96 | | - echo "The results of the sync are on the i18n_sync branch, PR them from there for merge." |
97 | | - echo "https://github.com/ankidroid/Anki-Android/compare/i18n_sync?expand=1" |
98 | 106 |
|
99 | | - - name: Check if there are strings changes |
100 | | - id: tr_check |
| 107 | + - name: Update Summary |
| 108 | + if: steps.tr_check.outputs.HAS_CHANGES == 'false' |
101 | 109 | run: | |
102 | | - git checkout i18n_sync |
103 | | - COMMITS_COUNT=`git rev-list --count HEAD ^main` |
104 | | - if [ "$COMMITS_COUNT" -gt 0 ]; then |
105 | | - echo "HAS_CHANGES=true" >> $GITHUB_OUTPUT |
106 | | - else |
107 | | - echo "HAS_CHANGES=false" >> $GITHUB_OUTPUT |
108 | | - fi |
| 110 | + echo "Translation Sync Result: No new translation found on Crowdin. No Pull Request necessary" >> $GITHUB_STEP_SUMMARY |
109 | 111 |
|
110 | 112 | - name: Create PR for strings changes if needed |
111 | | - if: ${{ steps.tr_check.outputs.HAS_CHANGES }} |
112 | | - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 |
| 113 | + if: steps.tr_check.outputs.HAS_CHANGES == 'true' |
| 114 | + uses: actions/github-script@v9 |
113 | 115 | with: |
114 | 116 | github-token: ${{ secrets.MACHINE_ACCOUNT_PAT }} |
115 | 117 | script: | |
|
0 commit comments