ci: tighten crowdin and i18n PR checks

This commit is contained in:
春河晴
2026-03-13 00:35:11 +09:00
parent 6bac2b9331
commit 4b7ee3923c
6 changed files with 132 additions and 15 deletions

View File

@@ -2,6 +2,10 @@
name: PR Precheck
on: [pull_request]
permissions:
contents: read
issues: write
jobs:
conflict-check:
runs-on: ubuntu-24.04
@@ -11,19 +15,37 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Check Conflicts
id: check-conflicts
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
git fetch origin main
$conflicts = git diff --name-only --diff-filter=U origin/main...HEAD
if ($conflicts) {
echo "conflict=true" >> $env:GITHUB_OUTPUT
Write-Host "Conflicts detected in files: $conflicts"
} else {
echo "conflict=false" >> $env:GITHUB_OUTPUT
Write-Host "No conflicts detected"
}
shell: pwsh
set -euo pipefail
git fetch origin "$BASE_REF":"refs/remotes/origin/$BASE_REF" --depth=1
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
if git merge --no-commit --no-ff "origin/$BASE_REF" > /tmp/precheck-merge.log 2>&1; then
echo "conflict=false" >> "$GITHUB_OUTPUT"
echo "No conflicts detected against origin/$BASE_REF"
git merge --abort > /dev/null 2>&1 || true
exit 0
fi
if git diff --name-only --diff-filter=U | grep -q .; then
echo "conflict=true" >> "$GITHUB_OUTPUT"
echo "Conflicts detected against origin/$BASE_REF:"
git diff --name-only --diff-filter=U
else
echo "conflict=false" >> "$GITHUB_OUTPUT"
echo "Merge check returned non-zero without unmerged files against origin/$BASE_REF"
cat /tmp/precheck-merge.log
fi
git merge --abort > /dev/null 2>&1 || true
shell: bash
labeler:
runs-on: ubuntu-24.04
needs: conflict-check