From 79d461c8c4ab2b8062af2e1907a02a97b9b9b629 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 9 Jul 2024 11:54:43 -0400 Subject: [PATCH] build: auto label prs (#1347) * build: auto label prs * build: auto label prs * build: auto label prs * build: auto label prs * build: auto label prs * build: update regex to support scope --- .github/labeler.yml | 45 +++++++++++++++++++++++++++++++++ .github/workflows/label.yml | 26 ------------------- .github/workflows/pr-triage.yml | 19 ++++++++++++++ 3 files changed, 64 insertions(+), 26 deletions(-) create mode 100644 .github/labeler.yml delete mode 100644 .github/workflows/label.yml create mode 100644 .github/workflows/pr-triage.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 000000000..b90000d11 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,45 @@ +version: v1 + +labels: + - label: 'enhancement' + matcher: + title: '^feat(\(\w+\))?: .*' + + - label: 'bug' + matcher: + title: '^fix(\(\w+\))?: .*' + + - label: 'refactor' + matcher: + title: '^refactor(\(\w+\))?: .*' + + - label: 'documentation' + matcher: + title: '^docs(\(\w+\))?: .*' + + - label: 'test' + matcher: + title: '^test(\(\w+\))?: .*' + + - label: 'build' + matcher: + title: '^(ci|build)(\(\w+\))?: .*' + + - label: 'dependency' + matcher: + title: '^(deps)(\(\w+\))?: .*' + +checks: + - context: 'Semantic Pull Request' + description: + success: Ready for review & merge. + failure: Missing semantic label for merge. + labels: + any: + - enhancement + - bug + - refactor + - documentation + - test + - build + - dependency \ No newline at end of file diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml deleted file mode 100644 index d9984b215..000000000 --- a/.github/workflows/label.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Check PR Label - -on: - pull_request: - types: [opened, edited, labeled, unlabeled] - -jobs: - check-label: - runs-on: ubuntu-latest - - steps: - - name: Check out the repository - uses: actions/checkout@v4 - - - name: Check if PR has labels - id: check_labels - run: | - labels=$(jq -r '.pull_request.labels | length' $GITHUB_EVENT_PATH) - if [ "$labels" -eq 0 ]; then - echo "No labels found on the PR" - exit 1 - fi - - - name: Set status - if: failure() - run: echo "Please add at least one label to the Pull Request." diff --git a/.github/workflows/pr-triage.yml b/.github/workflows/pr-triage.yml new file mode 100644 index 000000000..03f130e1c --- /dev/null +++ b/.github/workflows/pr-triage.yml @@ -0,0 +1,19 @@ +name: Triage PR + +on: + pull_request: + types: [opened, edited, synchronize, ready_for_review] + branches: [master, main] + +permissions: + contents: read # the config file + pull-requests: write # for labeling pull requests (on: pull_request_target or on: pull_request) + statuses: write # to generate status + checks: write # to generate status + +jobs: + labeler: + name: Labeler + runs-on: ubuntu-latest + steps: + - uses: fuxingloh/multi-labeler@v4 \ No newline at end of file