From 59963b397fd832118bb57b1eb2aaf9fdcea9bbad Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 9 Jul 2024 06:47:37 -0700 Subject: [PATCH 1/6] build: auto label prs --- .github/labeler.yml | 41 +++++++++++++++++++++++++++++++++ .github/workflows/label.yml | 26 --------------------- .github/workflows/pr-triage.yml | 11 +++++++++ 3 files changed, 52 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..f3bc021ac --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,41 @@ +version: v1 + +labels: + - label: 'enhancement' + matcher: + title: '^feat: .*' + + - label: 'bug' + matcher: + title: '^fix: .*' + + - label: 'refactor' + matcher: + title: '^refactor: .*' + + - label: 'documentation' + matcher: + title: '^docs: .*' + + - label: 'test' + matcher: + title: '^test: .*' + + - label: 'build' + matcher: + title: '^ci: .*' + +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..178e1682e --- /dev/null +++ b/.github/workflows/pr-triage.yml @@ -0,0 +1,11 @@ +on: + pull_request: + types: [opened, edited, synchronize, ready_for_review] + branches: [master, main] + +jobs: + labeler: + name: Labeler + runs-on: ubuntu-latest + steps: + - uses: fuxingloh/multi-labeler@v4 \ No newline at end of file From 036014d4a002ace751a289c81fe5e918ad94834a Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 9 Jul 2024 06:49:01 -0700 Subject: [PATCH 2/6] build: auto label prs --- .github/workflows/pr-triage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/pr-triage.yml b/.github/workflows/pr-triage.yml index 178e1682e..8d10a18ec 100644 --- a/.github/workflows/pr-triage.yml +++ b/.github/workflows/pr-triage.yml @@ -1,3 +1,5 @@ +name: Triage PR + on: pull_request: types: [opened, edited, synchronize, ready_for_review] From a720bece58f7386cb5738b0ff2025fe59c463579 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 9 Jul 2024 06:50:43 -0700 Subject: [PATCH 3/6] build: auto label prs --- .github/workflows/pr-triage.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/pr-triage.yml b/.github/workflows/pr-triage.yml index 8d10a18ec..03f130e1c 100644 --- a/.github/workflows/pr-triage.yml +++ b/.github/workflows/pr-triage.yml @@ -5,6 +5,12 @@ on: 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 From 7c5d49c83724dc6a6d8d70592c828fb80c5de922 Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 9 Jul 2024 06:53:07 -0700 Subject: [PATCH 4/6] build: auto label prs --- .github/labeler.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index f3bc021ac..3859acf1d 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -23,7 +23,7 @@ labels: - label: 'build' matcher: - title: '^ci: .*' + title: '^(ci|build): .*' checks: - context: 'Semantic Pull Request' From 13dc5747b044f3719661eefdd2967ce098455fbc Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 9 Jul 2024 07:00:49 -0700 Subject: [PATCH 5/6] build: auto label prs --- .github/labeler.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index 3859acf1d..71487c068 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -24,6 +24,10 @@ labels: - label: 'build' matcher: title: '^(ci|build): .*' + + - label: 'dependency' + matcher: + title: '^(deps): .*' checks: - context: 'Semantic Pull Request' From 05155f807cc3a1f2d5eb4621dd486ff009ed50ad Mon Sep 17 00:00:00 2001 From: Adam Setch Date: Tue, 9 Jul 2024 07:08:12 -0700 Subject: [PATCH 6/6] build: update regex to support scope --- .github/labeler.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 71487c068..b90000d11 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -3,31 +3,31 @@ version: v1 labels: - label: 'enhancement' matcher: - title: '^feat: .*' + title: '^feat(\(\w+\))?: .*' - label: 'bug' matcher: - title: '^fix: .*' + title: '^fix(\(\w+\))?: .*' - label: 'refactor' matcher: - title: '^refactor: .*' + title: '^refactor(\(\w+\))?: .*' - label: 'documentation' matcher: - title: '^docs: .*' + title: '^docs(\(\w+\))?: .*' - label: 'test' matcher: - title: '^test: .*' + title: '^test(\(\w+\))?: .*' - label: 'build' matcher: - title: '^(ci|build): .*' + title: '^(ci|build)(\(\w+\))?: .*' - label: 'dependency' matcher: - title: '^(deps): .*' + title: '^(deps)(\(\w+\))?: .*' checks: - context: 'Semantic Pull Request'