ci: tighten crowdin and i18n PR checks
This commit is contained in:
42
.github/workflows/precheck.yml
vendored
42
.github/workflows/precheck.yml
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user