54
54
55
55
- name : Install dependencies
56
56
run : |
57
- pip install requests
57
+ pip install requests pyyaml
58
58
59
59
- name : Get current branch name
60
60
id : get-branch
@@ -124,6 +124,10 @@ jobs:
124
124
done < modified_files.txt
125
125
python3 .github/scripts/translate_to_ja.py ./dir.yaml
126
126
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
+
127
131
- name : Update last translation commit hash
128
132
if : steps.modified-files.outputs.has_changes == 'true'
129
133
run : |
@@ -146,8 +150,10 @@ jobs:
146
150
exit 0
147
151
fi
148
152
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
+
151
157
git commit -m "$commit_msg"
152
158
git push origin "$new_branch"
153
159
echo "new_branch=$new_branch" >> $GITHUB_ENV
@@ -157,17 +163,21 @@ jobs:
157
163
env :
158
164
GH_TOKEN : ${{ steps.app-token.outputs.token }}
159
165
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}"
161
170
pr_body="Automatically sync Japanese translations for changes in en_US documentation.
162
171
163
172
English Changes: https://github.com/emqx/emqx-docs/compare/${{ steps.last-hash.outputs.last_hash }}...${{ steps.current-hash.outputs.current_hash }}
164
173
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."
166
177
167
178
gh pr create \
168
179
--title "$pr_title" \
169
180
--body "$pr_body" \
170
181
--base "${{ steps.get-branch.outputs.branch_name }}" \
171
182
--head "${{ env.new_branch }}" \
172
- --label "japanese,auto-translation" \
173
183
--reviewer "SuncNoob"
0 commit comments