From a0bf0ea75de8d92beb7a55462101293f993d0ace Mon Sep 17 00:00:00 2001 From: SengokuCola <1026294844@qq.com> Date: Fri, 14 Mar 2025 09:52:48 +0800 Subject: [PATCH] Create precheck.yml --- .github/workflows/precheck.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/precheck.yml diff --git a/.github/workflows/precheck.yml b/.github/workflows/precheck.yml new file mode 100644 index 000000000..a7524ccb3 --- /dev/null +++ b/.github/workflows/precheck.yml @@ -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: ['🚫冲突需处理'] + })