mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
40 lines
1.1 KiB
YAML
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"
|