Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 9 additions & 24 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ name: Triage PR

on:
pull_request_target:
branches:
- main
types:
- opened
- reopened
- edited
- synchronize
- ready_for_review
branches:
- main

permissions:
contents: read # the config file
Expand All @@ -17,31 +18,15 @@ permissions:
checks: write # to generate status

jobs:
pr-lint:
pr-title:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const title = context.payload.pull_request.title;
const regex = /^(?<type>build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|deps)(?<scope>\([\w\-\/]+\)?((?=:\s)|(?=!:\s)))?(?<breaking>!)?(?<subject>:\s.*)?/gm;
const match = regex.exec(title);

if (!match) {
core.setFailed('Invalid PR title');
}
if (!match.groups.type && !match.groups.subject) {
core.setFailed('Missing type and subject in PR title');
}
if (!match.groups.type) {
core.setFailed('Missing type in PR title');
}
if (!match.groups.subject) {
core.setFailed('Missing subject in PR title');
}

labeler:
- uses: amannn/action-semantic-pull-request@0723387faaf9b38adef4775cd42cfd5155ed6017 # v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pr-labeler:
name: Auto-label PR
runs-on: ubuntu-latest
steps:
Expand Down
Loading