|
19 | 19 | steps: |
20 | 20 | - uses: actions/checkout@v6 |
21 | 21 | with: |
22 | | - token: ${{ secrets.MACHINE_ACCOUNT_PAT }} |
| 22 | + token: ${{ secrets.MACHINE_ACCOUNT_PAT}} |
23 | 23 | ref: 'main' |
24 | 24 | fetch-depth: 0 |
25 | 25 |
|
@@ -88,27 +88,29 @@ 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 }} |
| 113 | + if: steps.tr_check.outputs.HAS_CHANGES == 'true' |
112 | 114 | uses: actions/github-script@v9 |
113 | 115 | with: |
114 | 116 | github-token: ${{ secrets.MACHINE_ACCOUNT_PAT }} |
|
0 commit comments