|
19 | 19 | steps: |
20 | 20 | - uses: actions/checkout@v6 |
21 | 21 | with: |
22 | | - token: ${{ secrets.MACHINE_ACCOUNT_PAT }} |
| 22 | + token: ${{ secrets.GITHUB_TOKEN }} |
23 | 23 | ref: 'main' |
24 | 24 | fetch-depth: 0 |
25 | 25 |
|
|
38 | 38 |
|
39 | 39 | - name: Get second to latest run time |
40 | 40 | env: |
41 | | - GH_TOKEN: ${{ secrets.MACHINE_ACCOUNT_PAT }} |
| 41 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
42 | 42 | run: | |
43 | 43 | OUTPUT=$(gh run list --workflow sync_translations.yml --json updatedAt | jq -r '.[1].updatedAt') |
44 | 44 | echo "LATEST_RUN=$OUTPUT" >> $GITHUB_ENV |
@@ -69,49 +69,70 @@ jobs: |
69 | 69 | yarn build |
70 | 70 |
|
71 | 71 | - name: Push translation sources to crowdin |
72 | | - run: | |
73 | | - cd ./tools/localization |
74 | | - yarn start upload |
| 72 | +# run: | |
| 73 | +# cd ./tools/localization |
| 74 | +# yarn start upload |
| 75 | + run : echo "Skipping update for testing" |
75 | 76 |
|
76 | 77 | - name: Pull translation updates from crowdin |
77 | | - run: | |
78 | | - cd ./tools/localization |
79 | | - yarn start download |
| 78 | +# run: | |
| 79 | +# cd ./tools/localization |
| 80 | +# yarn start download |
| 81 | + run : echo "Skipping update for testing" |
80 | 82 |
|
81 | 83 | - name: Extract downloaded ankidroid.zip file |
82 | | - run: | |
83 | | - cd ./tools/localization |
84 | | - yarn start extract |
| 84 | +# run: | |
| 85 | +# cd ./tools/localization |
| 86 | +# yarn start extract |
| 87 | + run : echo "Skipping update for testing" |
85 | 88 |
|
86 | 89 | - name: Update translation to AnkiDroid res |
87 | | - run: | |
88 | | - cd ./tools/localization |
89 | | - yarn start update |
| 90 | +# run: | |
| 91 | +# cd ./tools/localization |
| 92 | +# yarn start update |
| 93 | + run : echo "Skipping update for testing" |
90 | 94 |
|
91 | | - - name: Commit changes |
92 | | - run: | |
93 | | - git add docs/marketing/localized_description AnkiDroid/src/main/res |
94 | | - git commit -am 'Updated strings from Crowdin' |
95 | | - 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 | | -
|
99 | | - - name: Check if there are strings changes |
| 95 | + - name: Check for changes and handle Neutral result |
100 | 96 | id: tr_check |
101 | | - 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 |
| 97 | + if: always() |
| 98 | + uses: actions/github-script@v7 |
| 99 | + with: |
| 100 | + script: | |
| 101 | + const { execSync } = require('child_process'); |
| 102 | + |
| 103 | + execSync('git add docs/marketing/localized_description AnkiDroid/src/main/res'); |
| 104 | + |
| 105 | + const status = execSync('git diff --cached --name-only').toString().trim(); |
| 106 | + |
| 107 | + if(!status) { |
| 108 | + console.log("No changes detected. Setting status to neutral."); |
| 109 | + |
| 110 | + await github.rest.checks.create({ |
| 111 | + owner: context.repo.owner, |
| 112 | + repo: context.repo.repo, |
| 113 | + name: 'Sync Translations with Crowdin', |
| 114 | + head_sha: context.sha, |
| 115 | + status: 'completed', |
| 116 | + conclusion: 'neutral', |
| 117 | + output: { |
| 118 | + title: 'Translation Sync', |
| 119 | + summary: 'No translation changes were found on Crowdin to sync' |
| 120 | + } |
| 121 | + }); |
| 122 | + |
| 123 | + core.setOutput('HAS_CHANGES', 'false'); |
| 124 | + } else { |
| 125 | + core.setOutput('HAS_CHANGES', 'true'); |
| 126 | + execSync("git commit -m 'Updated strings from Crowdin'"); |
| 127 | + execSync("git push --set-upstream origin +i18n_sync"); |
| 128 | + console.log("Changes pushed to i18n_sync branch"); |
| 129 | + } |
109 | 130 |
|
110 | 131 | - name: Create PR for strings changes if needed |
111 | | - if: ${{ steps.tr_check.outputs.HAS_CHANGES }} |
| 132 | + if: steps.tr_check.outputs.HAS_CHANGES == 'true' |
112 | 133 | uses: actions/github-script@v9 |
113 | 134 | with: |
114 | | - github-token: ${{ secrets.MACHINE_ACCOUNT_PAT }} |
| 135 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
115 | 136 | script: | |
116 | 137 | const now = new Date(); |
117 | 138 | // Date format used: YYYY/MM/DD HH:MM , UTC time(ex: 2023/01/13 08:38) |
|
0 commit comments