Create precheck.yml

pull/408/head
SengokuCola 2025-03-14 09:52:48 +08:00 committed by GitHub
parent 62dd1a0979
commit a0bf0ea75d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 29 additions and 0 deletions

29
.github/workflows/precheck.yml vendored 100644
View File

@ -0,0 +1,29 @@
# .github/workflows/precheck.yml
name: PR Precheck
on: [pull_request]
jobs:
conflict-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check Conflicts
run: |
git fetch origin main
if git diff --name-only --diff-filter=U origin/main...HEAD | grep .; then
echo "CONFLICT=true" >> $GITHUB_ENV
fi
labeler:
runs-on: ubuntu-latest
needs: conflict-check
steps:
- uses: actions/github-script@v6
if: env.CONFLICT == 'true'
with:
script: |
github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['🚫冲突需处理']
})