mod-playerbots/.github/workflows/label_translation-pr.yml
2026-04-04 22:10:14 +02:00

40 lines
1.1 KiB
YAML

name: Label translation PRs
on:
pull_request_target:
types: [opened, synchronize, reopened]
permissions:
contents: read
pull-requests: write
jobs:
label-translation:
runs-on: ubuntu-latest
steps:
- name: Fetch PR diff
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api \
repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} \
--header "Accept: application/vnd.github.v3.diff" > pr.diff
- name: Detect ai_playerbot_texts inserts
id: detect
run: |
if grep -E '^\+.*INSERT[[:space:]]+INTO[[:space:]]+`?ai_playerbot_texts`?' pr.diff; then
echo "has_translation=true" >> "$GITHUB_OUTPUT"
else
echo "has_translation=false" >> "$GITHUB_OUTPUT"
fi
- name: Add label
if: steps.detect.outputs.has_translation == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr edit ${{ github.event.pull_request.number }} \
--repo ${{ github.repository }} \
--add-label "Added translation"