ci: simplify translate workflow by using gh instead of peter-evans/create-pull-request (#2237)

This commit is contained in:
Kévin Dunglas
2026-03-09 15:55:15 +01:00
committed by GitHub
parent 1f484321a0
commit 16a70e4f10
2 changed files with 24 additions and 17 deletions
+1
View File
@@ -30,6 +30,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: /
MARKDOWN_CONFIG_FILE: .markdown-lint.yaml
FILTER_REGEX_EXCLUDE: docs/(cn|es|fr|ja|pt-br|ru|tr)/
VALIDATE_CPP: false
VALIDATE_JSCPD: false
VALIDATE_GO: false
+23 -17
View File
@@ -20,7 +20,9 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
# zizmor: ignore[artipacked]
# persist-credentials is intentionally left enabled (unlike other workflows)
# because this workflow needs to push a branch via git push
- id: md_files
run: |
FILES=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- 'docs/*.md')
@@ -47,23 +49,27 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LINTER_RULES_PATH: /
MARKDOWN_CONFIG_FILE: .markdown-lint.yaml
FIX_NATURAL_LANGUAGE: true
VALIDATE_NATURAL_LANGUAGE: false
FIX_MARKDOWN: true
- name: Create Pull Request
if: steps.md_files.outputs.found == 'true'
uses: peter-evans/create-pull-request@v8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
title: "docs: update translations"
commit-message: "docs: update translations"
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>
branch: translations/${{ github.run_id }}
delete-branch: true
body: |
Translation updates for: ${{ steps.md_files.outputs.files }}.
labels: |
translations
bot
draft: false
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTOR: ${{ github.actor }}
ACTOR_ID: ${{ github.actor_id }}
RUN_ID: ${{ github.run_id }}
MD_FILES_LIST: ${{ steps.md_files.outputs.files }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
BRANCH="translations/$RUN_ID"
git checkout -b "$BRANCH"
git add docs/
git diff --cached --quiet && exit 0
git commit -m "docs: update translations" --author="$ACTOR <$ACTOR_ID+$ACTOR@users.noreply.github.com>"
git push origin "$BRANCH"
gh pr create \
--title "docs: update translations" \
--body "Translation updates for: $MD_FILES_LIST." \
--label "translations" \
--label "bot"