Skip to content

Commit

Permalink
chore(gha): fix donwload workflow for empty case
Browse files Browse the repository at this point in the history
  • Loading branch information
Kohei Asai committed Feb 19, 2024
1 parent eb8bfff commit c70a11a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/workflows/i18n-download.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ on:
repository_dispatch:
types:
- simplelocalize_publication
push:
branches:
- fix-download-workflow
jobs:
download-and-apply:
name: Dictionary Download
Expand All @@ -20,7 +23,14 @@ jobs:
command: download
args: --downloadFormat=single-language-json --downloadPath=./src/locales/{lang}/{ns}.json
api-key: ${{ secrets.SIMPLELOCALIZE_API_KEY }}
- name: Check the change stats
id: stats
run: |
changes="$(echo "$(git diff --name-only)" | jq --raw-input --slurp 'split("\n") | map(select(length>0))' --compact-output)"
echo "change-count=$(echo $changes | jq --raw-output 'length')" >> $GITHUB_OUTPUT
echo "change-list=$(echo $changes | jq --raw-output 'map("- " +.+ "\n") | join("")')" >> $GITHUB_OUTPUT
- name: Commit the changes and pushes a feature branch
if: ${{ steps.stats.outputs.change-count >= 1 }}
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
Expand All @@ -29,6 +39,7 @@ jobs:
git commit -m "feat(i18n): apply i18n dictionary update(s)"
git push origin i18n-update-${{ github.run_id }}
- name: Create a pull request
if: ${{ steps.stats.outputs.change-count >= 1 }}
run: |
gh pr create \
--base main \
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/i18n-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main
- i18n-automation-setup
jobs:
parse-and-upload:
name: Dictionary Upload
Expand Down

0 comments on commit c70a11a

Please sign in to comment.