From d51345e29754ba92a0c2fd6534bbd248ff298331 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Fri, 8 Nov 2024 22:35:18 +0800 Subject: [PATCH] ci: reduce unnecessary pr-filter runs (#2033) - Checking the repository of the PR is more effective than checking the label to identify bot-initiated PRs - This change also allows more flexible PR body definitions for developers with write access to the repository --- .github/workflows/pr-filter.yml | 1 + .github/workflows/scripts/pr-filter.js | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-filter.yml b/.github/workflows/pr-filter.yml index 42e1d64..8e9a18b 100644 --- a/.github/workflows/pr-filter.yml +++ b/.github/workflows/pr-filter.yml @@ -6,6 +6,7 @@ on: jobs: check-template: + if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name runs-on: ubuntu-latest permissions: pull-requests: write diff --git a/.github/workflows/scripts/pr-filter.js b/.github/workflows/scripts/pr-filter.js index 9724201..03f50dc 100644 --- a/.github/workflows/scripts/pr-filter.js +++ b/.github/workflows/scripts/pr-filter.js @@ -16,8 +16,7 @@ module.exports = async ({ github, context, core }) => { const action = context.payload.action; const isValid = - pr.labels.length > 0 || // PR create by Dependabot would have labels - (markdown !== '' && hasTypes(markdown) && hasDescription(markdown)); + markdown !== '' && hasTypes(markdown) && hasDescription(markdown); if (!isValid) { await github.rest.pulls.update({