mirror of
https://github.com/scratchfoundation/scratch-l10n.git
synced 2024-12-22 05:32:34 -05:00
ci: use output parameter for MADE_CHANGES check
Previously, this was using outdated and 'insecure' syntax for setting an environment variable. More info here: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ This could have been solved by using `echo STUFF >> "$GITHUB_ENV"` but I think using a step output is even better, mainly because it's more clear what kind of changes `MADE_CHANGES` is talking about. I also reordered the commands so that if writing the step output fails, the step will fail before pushing the changes. That means we'll no longer end up with half-released changes (released on GitHub but not NPM).
This commit is contained in:
parent
1005cedd9b
commit
6192ffed75
1 changed files with 4 additions and 3 deletions
7
.github/workflows/daily-tx-pull.yml
vendored
7
.github/workflows/daily-tx-pull.yml
vendored
|
@ -41,18 +41,19 @@ jobs:
|
|||
npm run test
|
||||
|
||||
- name: Commit translation updates
|
||||
id: commit
|
||||
run: |
|
||||
git config --global user.email $(git log --pretty=format:"%ae" -n1)
|
||||
git config --global user.name $(git log --pretty=format:"%an" -n1)
|
||||
git add .
|
||||
if git diff --cached --exit-code --quiet; then
|
||||
echo "MADE_CHANGES=false" >> "$GITHUB_OUTPUT"
|
||||
echo "Nothing to commit."
|
||||
echo "::set-env name=MADE_CHANGES::false"
|
||||
else
|
||||
git commit -m "pull new editor translations from Transifex"
|
||||
echo "MADE_CHANGES=true" >> "$GITHUB_OUTPUT"
|
||||
git push origin HEAD:master
|
||||
echo "::set-env name=MADE_CHANGES::true"
|
||||
fi
|
||||
- name: Start CI/CD workflow if changes were made
|
||||
if: env.MADE_CHANGES == 'true'
|
||||
if: steps.commit.outputs.MADE_CHANGES == 'true'
|
||||
uses: ./.github/workflows/ci-cd.yml
|
||||
|
|
Loading…
Reference in a new issue