Skip to content

Commit 2585679

Browse files
committed
chore(ci): fix translate workflow
Signed-off-by: Swilder-M <i@codming.com>
1 parent ed8bd26 commit 2585679

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

.github/workflows/translate_to_ja.yaml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454

5555
- name: Install dependencies
5656
run: |
57-
pip install requests
57+
pip install requests pyyaml
5858
5959
- name: Get current branch name
6060
id: get-branch
@@ -124,6 +124,10 @@ jobs:
124124
done < modified_files.txt
125125
python3 .github/scripts/translate_to_ja.py ./dir.yaml
126126
127+
./gen.py ce | tee directory.json
128+
python3 .github/scripts/remove_unused.py directory.json $(pwd)
129+
git restore '*.md' ':!ja_JP/**/*.md'
130+
127131
- name: Update last translation commit hash
128132
if: steps.modified-files.outputs.has_changes == 'true'
129133
run: |
@@ -146,8 +150,10 @@ jobs:
146150
exit 0
147151
fi
148152
149-
commit_msg="docs(ja): sync translations from ${{ steps.last-hash.outputs.last_hash }} to ${{ steps.current-hash.outputs.current_hash }}"
150-
153+
last_short=$(echo "${{ steps.last-hash.outputs.last_hash }}" | cut -c1-7)
154+
current_short=$(echo "${{ steps.current-hash.outputs.current_hash }}" | cut -c1-7)
155+
commit_msg="docs(ja): sync translations from ${last_short} to ${current_short}"
156+
151157
git commit -m "$commit_msg"
152158
git push origin "$new_branch"
153159
echo "new_branch=$new_branch" >> $GITHUB_ENV
@@ -157,17 +163,21 @@ jobs:
157163
env:
158164
GH_TOKEN: ${{ steps.app-token.outputs.token }}
159165
run: |
160-
pr_title="docs(ja): sync translations from ${{ steps.last-hash.outputs.last_hash }} to ${{ steps.current-hash.outputs.current_hash }}"
166+
last_short=$(echo "${{ steps.last-hash.outputs.last_hash }}" | cut -c1-7)
167+
current_short=$(echo "${{ steps.current-hash.outputs.current_hash }}" | cut -c1-7)
168+
169+
pr_title="docs(ja): sync translations from ${last_short} to ${current_short}"
161170
pr_body="Automatically sync Japanese translations for changes in en_US documentation.
162171
163172
English Changes: https://github.com/emqx/emqx-docs/compare/${{ steps.last-hash.outputs.last_hash }}...${{ steps.current-hash.outputs.current_hash }}
164173
165-
This PR was automatically generated by the translation workflow."
174+
This PR was automatically generated by the translation workflow.
175+
176+
**Note**: Please delete the branch after merging this PR."
166177
167178
gh pr create \
168179
--title "$pr_title" \
169180
--body "$pr_body" \
170181
--base "${{ steps.get-branch.outputs.branch_name }}" \
171182
--head "${{ env.new_branch }}" \
172-
--label "japanese,auto-translation" \
173183
--reviewer "SuncNoob"

0 commit comments

Comments
 (0)