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
This commit is contained in:
Cotes Chung 2024-11-08 22:35:18 +08:00 committed by GitHub
parent 2f844978aa
commit d51345e297
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -6,6 +6,7 @@ on:
jobs: jobs:
check-template: check-template:
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
pull-requests: write pull-requests: write

View file

@ -16,8 +16,7 @@ module.exports = async ({ github, context, core }) => {
const action = context.payload.action; const action = context.payload.action;
const isValid = 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) { if (!isValid) {
await github.rest.pulls.update({ await github.rest.pulls.update({