From 0c0e6db5dad6d6160541fa4024a1f14d2edb2c92 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 15:40:46 +0330 Subject: [PATCH 01/21] ci: :construction_worker: add release drafter auto labeler github action --- .github/workflows/release-drafter-labeler.yml | 22 +++++++++++++++++++ .github/workflows/release-drafter.yml | 9 +------- 2 files changed, 23 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/release-drafter-labeler.yml diff --git a/.github/workflows/release-drafter-labeler.yml b/.github/workflows/release-drafter-labeler.yml new file mode 100644 index 0000000..cceaa98 --- /dev/null +++ b/.github/workflows/release-drafter-labeler.yml @@ -0,0 +1,22 @@ +name: Release Drafter Auto Labeler +on: + push: + # pull_request event is required only for autolabeler + pull_request: + # Only following types are handled by the action, but one can default to all as well + types: [opened, reopened, synchronize] + # pull_request_target event is required for autolabeler to support PRs from forks + pull_request_target: + types: [opened, reopened, synchronize] + +jobs: + auto-labeler: + name: Release drafter Auto Labeler + runs-on: ubuntu-latest + steps: + - uses: release-drafter/release-drafter@v6 + with: + config-name: release-drafter.yml + disable-releaser: true # only run auto-labeler for PRs + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 37f25d2..248cbfc 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -7,16 +7,9 @@ on: # branches to consider in the event; optional, defaults to all branches: - main - # pull_request event is required only for autolabeler - pull_request: - # Only following types are handled by the action, but one can default to all as well - types: [opened, reopened, synchronize] - # pull_request_target event is required for autolabeler to support PRs from forks - pull_request_target: - types: [opened, reopened, synchronize] jobs: - update_release_draft: + update-release-draft: name: Release drafter runs-on: ubuntu-latest From 15af0a8be4fd6c35a655f9dd050ea8f14b04abc5 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 16:14:58 +0330 Subject: [PATCH 02/21] ci: fix ci labeling issue --- .github/release-drafter.yml | 62 ++++++++++++------- .github/workflows/release-drafter-labeler.yml | 11 +++- .github/workflows/release-drafter.yml | 1 + 3 files changed, 47 insertions(+), 27 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 1b32944..520b2f1 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -66,49 +66,63 @@ categories: # Using regex for defining rules - https://regexr.com/ # https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax +# Auto-labeler: Assign labels based on branch names or PR titles that follow Conventional Commits autolabeler: -- label: 'chore' +- label: 'feature' + branch: + - '/feat\/.+/' # Matches branch names starting with feat/ + title: + - '/feat\: .+/' # Matches PR titles starting with feat: +- label: 'bugfix' + branch: + - '/fix\/.+/' # Matches branch names starting with fix/ + title: + - '/fix\: .+/' # Matches PR titles starting with fix: +- label: 'documentation' branch: - - '(chore)(\([a-z ]+\))?\/.' + - '/docs\/.+/' # Matches branch names starting with docs/ title: - - '^(chore)(\([a-z ]+\))?: .' -- label: 'bug' + - '/docs\: .+/' # Matches PR titles starting with docs: +- label: 'style' branch: - - '(fix)(\([a-z ]+\))?\/.' + - '/style\/.+/' # Matches branch names starting with style/ title: - - '^(fix)(\([a-z ]+\))?: .' + - '/style\: .+/' # Matches PR titles starting with style: - label: 'refactor' branch: - - '(refactor)(\([a-z ]+\))?\/.' + - '/refactor\/.+/' # Matches branch names starting with refactor/ title: - - '^(refactor)(\([a-z ]+\))?: .' + - '/refactor\: .+/' # Matches PR titles starting with refactor: - label: 'test' branch: - - '(test)(\([a-z ]+\))?\/.' + - '/test\/.+/' # Matches branch names starting with test/ title: - - '^(test)(\([a-z ]+\))?: .' -- label: 'feature' + - '/test\: .+/' # Matches PR titles starting with test: +- label: 'chore' + branch: + - '/chore\/.+/' # Matches branch names starting with chore/ + title: + - '/chore\: .+/' # Matches PR titles starting with chore: +- label: 'performance' branch: - - '(feat)(\([a-z ]+\))?\/.' + - '/perf\/.+/' # Matches branch names starting with perf/ title: - - '^(feat)(\([a-z ]+\))?: .' -- label: 'ci/cd' + - '/perf\: .+/' # Matches PR titles starting with perf: +- label: 'ci' branch: - - '(ci)(\([a-z ]+\))?\/.' + - '/ci\/.+/' # Matches branch names starting with ci/ title: - - '^(ci)(\([a-z ]+\))?: .' -- label: 'minor' + - '/ci\: .+/' # Matches PR titles starting with ci: +- label: 'build' branch: - - '(feat)(\([a-z ]+\))?\/.' + - '/build\/.+/' # Matches branch names starting with build/ title: - - '^(feat)(\([a-z ]+\))?: .' -- label: 'patch' + - '/build\: .+/' # Matches PR titles starting with build: +- label: 'revert' branch: - - '(fix)(\([a-z ]+\))?\/.' - - '(ci)(\([a-z ]+\))?\/.' + - '/revert\/.+/' # Matches branch names starting with revert/ title: - - '^(fix)(\([a-z ]+\))?: .' - - '^(ci)(\([a-z ]+\))?: .' + - '/revert\: .+/' # Matches PR titles starting with revert: change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. diff --git a/.github/workflows/release-drafter-labeler.yml b/.github/workflows/release-drafter-labeler.yml index cceaa98..eeba4fc 100644 --- a/.github/workflows/release-drafter-labeler.yml +++ b/.github/workflows/release-drafter-labeler.yml @@ -5,18 +5,23 @@ on: pull_request: # Only following types are handled by the action, but one can default to all as well types: [opened, reopened, synchronize] - # pull_request_target event is required for autolabeler to support PRs from forks - pull_request_target: - types: [opened, reopened, synchronize] jobs: auto-labeler: name: Release drafter Auto Labeler runs-on: ubuntu-latest + permissions: + # Setting up permissions in the workflow to limit the scope of what it can do. Optional! + contents: read + pull-requests: write + statuses: write + checks: write + steps: - uses: release-drafter/release-drafter@v6 with: config-name: release-drafter.yml + disable-autolabeler: false disable-releaser: true # only run auto-labeler for PRs env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 248cbfc..37f4857 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -26,6 +26,7 @@ jobs: id: semantic with: config-name: release-drafter.yml + disable-autolabeler: true ## Default versioning just increase the path version as default. but the can use minor, patch and breaking-changes labels to apply semver # version: 1.29.1 env: From 828eb3fe3589c6daa3d2ba15477755f98fa6b6ff Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 16:29:18 +0330 Subject: [PATCH 03/21] ci: change --- .github/workflows/release-drafter-labeler.yml | 24 +++++++++---------- .github/workflows/release-drafter.yml | 1 - 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release-drafter-labeler.yml b/.github/workflows/release-drafter-labeler.yml index eeba4fc..f0bb5f1 100644 --- a/.github/workflows/release-drafter-labeler.yml +++ b/.github/workflows/release-drafter-labeler.yml @@ -1,27 +1,25 @@ name: Release Drafter Auto Labeler on: - push: - # pull_request event is required only for autolabeler pull_request: - # Only following types are handled by the action, but one can default to all as well - types: [opened, reopened, synchronize] - + types: + - opened + - reopened + - synchronize + - edited + pull_request_target: + types: + - opened + - reopened + - synchronize + - edited jobs: auto-labeler: name: Release drafter Auto Labeler runs-on: ubuntu-latest - permissions: - # Setting up permissions in the workflow to limit the scope of what it can do. Optional! - contents: read - pull-requests: write - statuses: write - checks: write - steps: - uses: release-drafter/release-drafter@v6 with: config-name: release-drafter.yml - disable-autolabeler: false disable-releaser: true # only run auto-labeler for PRs env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 37f4857..0c67fc7 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -4,7 +4,6 @@ name: Release Drafter on: push: - # branches to consider in the event; optional, defaults to all branches: - main From e822ccc3808974d53157a77dd201ea9f72e93a35 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 16:39:45 +0330 Subject: [PATCH 04/21] ci: change --- .github/workflows/release-drafter.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 0c67fc7..5ffb75e 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -24,6 +24,7 @@ jobs: uses: release-drafter/release-drafter@v6 id: semantic with: + commitish: main config-name: release-drafter.yml disable-autolabeler: true ## Default versioning just increase the path version as default. but the can use minor, patch and breaking-changes labels to apply semver From 15aa5c4089883f1967f054d8c33f544032d68942 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 16:45:52 +0330 Subject: [PATCH 05/21] ci: change --- .github/workflows/release-drafter-labeler.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release-drafter-labeler.yml b/.github/workflows/release-drafter-labeler.yml index f0bb5f1..e0a0536 100644 --- a/.github/workflows/release-drafter-labeler.yml +++ b/.github/workflows/release-drafter-labeler.yml @@ -1,25 +1,20 @@ name: Release Drafter Auto Labeler on: + # pull_request event is required for autolabeler pull_request: - types: - - opened - - reopened - - synchronize - - edited - pull_request_target: - types: - - opened - - reopened - - synchronize - - edited + types: [opened, reopened, synchronize] jobs: auto-labeler: name: Release drafter Auto Labeler runs-on: ubuntu-latest + permissions: + # write permission is required for autolabeler + # otherwise, read permission is required at least + pull-requests: write steps: - uses: release-drafter/release-drafter@v6 with: config-name: release-drafter.yml - disable-releaser: true # only run auto-labeler for PRs + commitish: "main" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 6eb364ae96a9ee639c34aa6f7c5d759bae2df776 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 17:00:28 +0330 Subject: [PATCH 06/21] feat: some change --- .github/release-drafter.yml | 10 ++++++++++ .github/workflows/release-drafter-labeler.yml | 2 +- .github/workflows/release-drafter.yml | 1 - 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 520b2f1..938749a 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -73,51 +73,61 @@ autolabeler: - '/feat\/.+/' # Matches branch names starting with feat/ title: - '/feat\: .+/' # Matches PR titles starting with feat: + - label: 'bugfix' branch: - '/fix\/.+/' # Matches branch names starting with fix/ title: - '/fix\: .+/' # Matches PR titles starting with fix: + - label: 'documentation' branch: - '/docs\/.+/' # Matches branch names starting with docs/ title: - '/docs\: .+/' # Matches PR titles starting with docs: + - label: 'style' branch: - '/style\/.+/' # Matches branch names starting with style/ title: - '/style\: .+/' # Matches PR titles starting with style: + - label: 'refactor' branch: - '/refactor\/.+/' # Matches branch names starting with refactor/ title: - '/refactor\: .+/' # Matches PR titles starting with refactor: + - label: 'test' branch: - '/test\/.+/' # Matches branch names starting with test/ title: - '/test\: .+/' # Matches PR titles starting with test: + - label: 'chore' branch: - '/chore\/.+/' # Matches branch names starting with chore/ title: - '/chore\: .+/' # Matches PR titles starting with chore: + - label: 'performance' branch: - '/perf\/.+/' # Matches branch names starting with perf/ title: - '/perf\: .+/' # Matches PR titles starting with perf: + - label: 'ci' branch: - '/ci\/.+/' # Matches branch names starting with ci/ title: - '/ci\: .+/' # Matches PR titles starting with ci: + - label: 'build' branch: - '/build\/.+/' # Matches branch names starting with build/ title: - '/build\: .+/' # Matches PR titles starting with build: + - label: 'revert' branch: - '/revert\/.+/' # Matches branch names starting with revert/ diff --git a/.github/workflows/release-drafter-labeler.yml b/.github/workflows/release-drafter-labeler.yml index e0a0536..c62faef 100644 --- a/.github/workflows/release-drafter-labeler.yml +++ b/.github/workflows/release-drafter-labeler.yml @@ -15,6 +15,6 @@ jobs: - uses: release-drafter/release-drafter@v6 with: config-name: release-drafter.yml - commitish: "main" + disable-releaser: true # releaser mode is disabled. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 5ffb75e..0c67fc7 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -24,7 +24,6 @@ jobs: uses: release-drafter/release-drafter@v6 id: semantic with: - commitish: main config-name: release-drafter.yml disable-autolabeler: true ## Default versioning just increase the path version as default. but the can use minor, patch and breaking-changes labels to apply semver From 66f771e4e63a4ef3f13d82175c8763a91c026a9a Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 17:09:08 +0330 Subject: [PATCH 07/21] ci: change --- .../workflows/{release-drafter-labeler.yml => labeler.yml} | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) rename .github/workflows/{release-drafter-labeler.yml => labeler.yml} (83%) diff --git a/.github/workflows/release-drafter-labeler.yml b/.github/workflows/labeler.yml similarity index 83% rename from .github/workflows/release-drafter-labeler.yml rename to .github/workflows/labeler.yml index c62faef..4875eef 100644 --- a/.github/workflows/release-drafter-labeler.yml +++ b/.github/workflows/labeler.yml @@ -2,7 +2,7 @@ name: Release Drafter Auto Labeler on: # pull_request event is required for autolabeler pull_request: - types: [opened, reopened, synchronize] + types: [opened, reopened, synchronize, edited] jobs: auto-labeler: name: Release drafter Auto Labeler @@ -12,6 +12,9 @@ jobs: # otherwise, read permission is required at least pull-requests: write steps: + - name: Checkout repository + uses: actions/checkout@v3 + - uses: release-drafter/release-drafter@v6 with: config-name: release-drafter.yml From 50037989dd8d23217e6ef428d6e9239501ea7968 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 17:31:23 +0330 Subject: [PATCH 08/21] ci: change labeler --- .github/labeler.yml | 58 +++++++++++++++++++++++++++ .github/workflows/labeler.yml | 20 +++++---- .github/workflows/release-drafter.yml | 6 +-- 3 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 .github/labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..cec7d3d --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,58 @@ +# https://github.com/actions/labeler +# In some configurations (like Release Drafter), regex is enclosed with slashes (e.g., /build\/.+/), which signifies the start and end of the regular expression. +# However, in GitHub Actions' labeler.yml, you do not need to wrap your regex patterns in slashes. The tool expects just the regex itself, without the delimiters. + +# Feature +'feature': +- 'feat/.+' # Matches branch names starting with 'feat/' +- 'feat: .+' # Matches PR titles starting with 'feat: ' + +# Bug Fix +'bugfix': +- 'fix/.+' # Matches branch names starting with 'fix/' +- 'fix: .+' # Matches PR titles starting with 'fix: ' + +# Documentation +'documentation': +- 'docs/.+' # Matches branch names starting with 'docs/' +- 'docs: .+' # Matches PR titles starting with 'docs: ' + +# Style +'style': +- 'style/.+' # Matches branch names starting with 'style/' +- 'style: .+' # Matches PR titles starting with 'style: ' + +# Refactor +'refactor': +- 'refactor/.+' # Matches branch names starting with 'refactor/' +- 'refactor: .+' # Matches PR titles starting with 'refactor: ' + +# Test +'test': +- 'test/.+' # Matches branch names starting with 'test/' +- 'test: .+' # Matches PR titles starting with 'test: ' + +# Chore +'chore': +- 'chore/.+' # Matches branch names starting with 'chore/' +- 'chore: .+' # Matches PR titles starting with 'chore: ' + +# Performance +'performance': +- 'perf/.+' # Matches branch names starting with 'perf/' +- 'perf: .+' # Matches PR titles starting with 'perf: ' + +# Continuous Integration +'ci': +- 'ci/.+' # Matches branch names starting with 'ci/' +- 'ci: .+' # Matches PR titles starting with 'ci: ' + +# Build +'build': +- 'build/.+' # Matches branch names starting with 'build/' +- 'build: .+' # Matches PR titles starting with 'build: ' + +# Revert +'revert': +- 'revert/.+' # Matches branch names starting with 'revert/' +- 'revert: .+' # Matches PR titles starting with 'revert: ' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 4875eef..1f5b6e9 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -11,13 +11,17 @@ jobs: # write permission is required for autolabeler # otherwise, read permission is required at least pull-requests: write - steps: - - name: Checkout repository - uses: actions/checkout@v3 + contents: read - - uses: release-drafter/release-drafter@v6 + steps: + - name: Apply labels based on PR title and branch name + uses: actions/labeler@v5 with: - config-name: release-drafter.yml - disable-releaser: true # releaser mode is disabled. - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + + # - uses: release-drafter/release-drafter@v6 + # with: + # config-name: release-drafter.yml + # disable-releaser: true # releaser mode is disabled. + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 0c67fc7..b5bce64 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -5,7 +5,7 @@ name: Release Drafter on: push: branches: - - main + - "main" jobs: update-release-draft: @@ -15,10 +15,6 @@ jobs: permissions: # write permission is required to create a github release contents: write - # write permission is required for autolabeler - # otherwise, read permission is required at least - pull-requests: write - steps: - name: Update Release Draft uses: release-drafter/release-drafter@v6 From 85087d127e4cddfd0dd67051611e372aecc9d722 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 17:56:24 +0330 Subject: [PATCH 09/21] fix: fix labeler --- .github/labeler.yml | 87 +++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 54 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index cec7d3d..84b2e8f 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,58 +1,37 @@ # https://github.com/actions/labeler + # In some configurations (like Release Drafter), regex is enclosed with slashes (e.g., /build\/.+/), which signifies the start and end of the regular expression. # However, in GitHub Actions' labeler.yml, you do not need to wrap your regex patterns in slashes. The tool expects just the regex itself, without the delimiters. -# Feature -'feature': -- 'feat/.+' # Matches branch names starting with 'feat/' -- 'feat: .+' # Matches PR titles starting with 'feat: ' - -# Bug Fix -'bugfix': -- 'fix/.+' # Matches branch names starting with 'fix/' -- 'fix: .+' # Matches PR titles starting with 'fix: ' - -# Documentation -'documentation': -- 'docs/.+' # Matches branch names starting with 'docs/' -- 'docs: .+' # Matches PR titles starting with 'docs: ' - -# Style -'style': -- 'style/.+' # Matches branch names starting with 'style/' -- 'style: .+' # Matches PR titles starting with 'style: ' - -# Refactor -'refactor': -- 'refactor/.+' # Matches branch names starting with 'refactor/' -- 'refactor: .+' # Matches PR titles starting with 'refactor: ' - -# Test -'test': -- 'test/.+' # Matches branch names starting with 'test/' -- 'test: .+' # Matches PR titles starting with 'test: ' - -# Chore -'chore': -- 'chore/.+' # Matches branch names starting with 'chore/' -- 'chore: .+' # Matches PR titles starting with 'chore: ' - -# Performance -'performance': -- 'perf/.+' # Matches branch names starting with 'perf/' -- 'perf: .+' # Matches PR titles starting with 'perf: ' - -# Continuous Integration -'ci': -- 'ci/.+' # Matches branch names starting with 'ci/' -- 'ci: .+' # Matches PR titles starting with 'ci: ' - -# Build -'build': -- 'build/.+' # Matches branch names starting with 'build/' -- 'build: .+' # Matches PR titles starting with 'build: ' - -# Revert -'revert': -- 'revert/.+' # Matches branch names starting with 'revert/' -- 'revert: .+' # Matches PR titles starting with 'revert: ' +feature: +- head-branch: ['^feat/'] # Matches branch names starting with 'feat/' + +bugfix: +- head-branch: ['^fix/'] # Matches branch names starting with 'fix/' + +documentation: +- head-branch: ['^docs/'] + +style: +- head-branch: ['^style/'] + +refactor: +- head-branch: ['^refactor/'] + +test: +- head-branch: ['^test/'] + +chore: +- head-branch: ['^chore/'] + +performance: +- head-branch: ['^perf/'] + +ci: +- head-branch: ['^ci/'] + +build: +- head-branch: ['^build/'] + +revert: +- head-branch: ['^revert/'] From 44d436096ae1c2cca24de85ceb77fbfc7cce2eb0 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 18:05:24 +0330 Subject: [PATCH 10/21] fix: labeling --- .github/labeler.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index 84b2e8f..9834233 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -20,15 +20,22 @@ refactor: test: - head-branch: ['^test/'] +- changed-files: + - any-glob-to-any-file: 'tests/*' chore: - head-branch: ['^chore/'] +- changed-files: + - any-glob-to-any-file: 'readme.md' + - any-glob-to-any-file: 'package.json' performance: - head-branch: ['^perf/'] ci: - head-branch: ['^ci/'] +- changed-files: + - any-glob-to-any-file: '.github/workflows/*' build: - head-branch: ['^build/'] From 0b10df6d6aa79e27313ea6bb65da2c092fe332c1 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 18:20:47 +0330 Subject: [PATCH 11/21] fix: fix labeling --- .github/labeler.yml | 14 +++++++------- .github/workflows/labeler.yml | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 9834233..229a907 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -20,22 +20,22 @@ refactor: test: - head-branch: ['^test/'] -- changed-files: - - any-glob-to-any-file: 'tests/*' +# - changed-files: +# - any-glob-to-any-file: 'tests/*' chore: - head-branch: ['^chore/'] -- changed-files: - - any-glob-to-any-file: 'readme.md' - - any-glob-to-any-file: 'package.json' +# - changed-files: +# - any-glob-to-any-file: 'readme.md' +# - any-glob-to-any-file: 'package.json' performance: - head-branch: ['^perf/'] ci: - head-branch: ['^ci/'] -- changed-files: - - any-glob-to-any-file: '.github/workflows/*' +# - changed-files: +# - any-glob-to-any-file: '.github/workflows/*' build: - head-branch: ['^build/'] diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 1f5b6e9..ed3ca2c 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,11 +1,10 @@ -name: Release Drafter Auto Labeler +name: Auto Labeler on: - # pull_request event is required for autolabeler - pull_request: - types: [opened, reopened, synchronize, edited] + - pull_request_target + jobs: auto-labeler: - name: Release drafter Auto Labeler + name: Auto Labeler runs-on: ubuntu-latest permissions: # write permission is required for autolabeler @@ -18,6 +17,7 @@ jobs: uses: actions/labeler@v5 with: repo-token: ${{ secrets.GITHUB_TOKEN }} + configuration-path: ".github/labeler.yml" # - uses: release-drafter/release-drafter@v6 # with: From b65065573f6020e04cf01bab47bda3f966f08485 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 16:55:44 +0200 Subject: [PATCH 12/21] ci: Update labeler.yml --- .github/workflows/labeler.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index ed3ca2c..0fc0d39 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,6 +1,7 @@ name: Auto Labeler on: - - pull_request_target + pull_request: + types: [ opened, edited, synchronize, ready_for_review ] jobs: auto-labeler: From 65abe25921ece073267d320686069ed3c0ae3c10 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 17:00:23 +0200 Subject: [PATCH 13/21] ci: Update labeler.yml --- .github/workflows/labeler.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 0fc0d39..471af51 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -14,6 +14,7 @@ jobs: contents: read steps: + - uses: actions/checkout@v4 # Uploads repository content to the runner - name: Apply labels based on PR title and branch name uses: actions/labeler@v5 with: From 01320c0d9f0028f06922b3d75e6a0b20b3493439 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Mon, 16 Sep 2024 18:48:35 +0330 Subject: [PATCH 14/21] fix: labeling --- .github/labeler.yml | 10 ---- .github/multi-labeler.yml | 87 +++++++++++++++++++++++++++++++++++ .github/workflows/labeler.yml | 35 +++++++++++--- 3 files changed, 115 insertions(+), 17 deletions(-) create mode 100644 .github/multi-labeler.yml diff --git a/.github/labeler.yml b/.github/labeler.yml index 229a907..13c9049 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -5,40 +5,30 @@ feature: - head-branch: ['^feat/'] # Matches branch names starting with 'feat/' - bugfix: - head-branch: ['^fix/'] # Matches branch names starting with 'fix/' - documentation: - head-branch: ['^docs/'] - style: - head-branch: ['^style/'] - refactor: - head-branch: ['^refactor/'] - test: - head-branch: ['^test/'] # - changed-files: # - any-glob-to-any-file: 'tests/*' - chore: - head-branch: ['^chore/'] # - changed-files: # - any-glob-to-any-file: 'readme.md' # - any-glob-to-any-file: 'package.json' - performance: - head-branch: ['^perf/'] - ci: - head-branch: ['^ci/'] # - changed-files: # - any-glob-to-any-file: '.github/workflows/*' - build: - head-branch: ['^build/'] - revert: - head-branch: ['^revert/'] diff --git a/.github/multi-labeler.yml b/.github/multi-labeler.yml new file mode 100644 index 0000000..f4a4e21 --- /dev/null +++ b/.github/multi-labeler.yml @@ -0,0 +1,87 @@ +# https://github.com/fuxingloh/multi-labeler +# https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax +version: v1 + +labels: + - label: "feature" + matcher: + title: '^(feat)(\([a-z ]+\))?: .' + commits: '^(feat)(\([a-z ]+\))?: .' + branch: '(feat)(\([a-z ]+\))?\/.' + + - label: "bug" + matcher: + title: '^(fix)(\([a-z ]+\))?: .' + commits: '^(fix)(\([a-z ]+\))?: .' + branch: '(fix)(\([a-z ]+\))?\/.' + + - label: "chore" + matcher: + title: '^(chore)(\([a-z ]+\))?: .' + commits: '^(chore)(\([a-z ]+\))?: .' + branch: '(chore)(\([a-z ]+\))?\/.' + + - label: "documentation" + matcher: + title: '^(docs)(\([a-z ]+\))?: .' + commits: '^(docs)(\([a-z ]+\))?: .' + branch: '(docs)(\([a-z ]+\))?\/.' + + - label: "devops" + matcher: + title: '^(ci)(\([a-z ]+\))?: .' + commits: '^(ci)(\([a-z ]+\))?: .' + branch: '(ci)(\([a-z ]+\))?\/.' + + - label: "ci/cd" + matcher: + title: '^(ci)(\([a-z ]+\))?: .' + commits: '^(ci)(\([a-z ]+\))?: .' + branch: '(ci)(\([a-z ]+\))?\/.' + + - label: "enhancement" + matcher: + title: '^(refactor)(\([a-z ]+\))?: .' + commits: '^(refactor)(\([a-z ]+\))?: .' + branch: '(refactor)(\([a-z ]+\))?\/.' + + - label: "formatting" + matcher: + title: '^(style)(\([a-z ]+\))?: .' + commits: '^(style)(\([a-z ]+\))?: .' + branch: '(style)(\([a-z ]+\))?\/.' + + - label: "performance" + matcher: + title: '^(perf)(\([a-z ]+\))?: .' + commits: '^(perf)(\([a-z ]+\))?: .' + branch: '(perf)(\([a-z ]+\))?\/.' + + - label: "build" + matcher: + title: '^(build)(\([a-z ]+\))?: .' + commits: '^(build)(\([a-z ]+\))?: .' + branch: '(build)(\([a-z ]+\))?\/.' + + - label: "test" + matcher: + title: '^(test)(\([a-z ]+\))?: .' + commits: '^(test)(\([a-z ]+\))?: .' + branch: '(test)(\([a-z ]+\))?\/.' + + - label: "dependencies" + matcher: + title: '^build\(deps\): .' + commits: '^build\(deps\): .' + + - label: "minor" + matcher: + title: '^(feat)(\([a-z ]+\))?: .' + commits: '^(feat)(\([a-z ]+\))?: .' + branch: '(feat)(\([a-z ]+\))?\/.' + + - label: "patch" + matcher: + title: '^(fix)(\([a-z ]+\))?: .' + commits: '^(fix)(\([a-z ]+\))?: .' + branch: '(fix)(\([a-z ]+\))?\/.' \ No newline at end of file diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 471af51..53bd042 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,7 +1,14 @@ name: Auto Labeler + on: pull_request: - types: [ opened, edited, synchronize, ready_for_review ] + types: + - opened + - synchronize + - reopened + - labeled + - unlabeled + - edited jobs: auto-labeler: @@ -12,14 +19,15 @@ jobs: # otherwise, read permission is required at least pull-requests: write contents: read + statuses: write + checks: write steps: - - uses: actions/checkout@v4 # Uploads repository content to the runner - - name: Apply labels based on PR title and branch name - uses: actions/labeler@v5 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: ".github/labeler.yml" + # - name: Apply labels based on PR title and branch name + # uses: actions/labeler@v5 + # with: + # repo-token: ${{ secrets.GITHUB_TOKEN }} + # configuration-path: ".github/labeler.yml" # - uses: release-drafter/release-drafter@v6 # with: @@ -27,3 +35,16 @@ jobs: # disable-releaser: true # releaser mode is disabled. # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: fuxingloh/multi-labeler@v1 + name: conventional-commits-pull-request-labeler + with: + github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' + config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' + + - name: check-conventional-commits-labels + uses: docker://agilepathway/pull-request-label-checker:latest + if: success() + with: + any_of: feature,bug,enhancement,refactor,deprecated,security,documentation,build,ci/cd,chore,performance,formatting,dependencies,test,major,minor,patch + repo_token: ${{ secrets.GITHUB_TOKEN }} From edcc6b87eb66bb288e977faee1d2b0b3f00587b1 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Tue, 17 Sep 2024 00:23:55 +0330 Subject: [PATCH 15/21] ci: some ci changes --- .github/labeler.yml | 185 ++++++++++++++++++++++++++----- .github/multi-labeler.yml | 138 +++++++++++------------ .github/release-drafter.yml | 73 ++++-------- .github/workflows/build-test.yml | 6 +- .github/workflows/labeler.yml | 40 +++---- 5 files changed, 274 insertions(+), 168 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 13c9049..cb48fd9 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -3,32 +3,167 @@ # In some configurations (like Release Drafter), regex is enclosed with slashes (e.g., /build\/.+/), which signifies the start and end of the regular expression. # However, in GitHub Actions' labeler.yml, you do not need to wrap your regex patterns in slashes. The tool expects just the regex itself, without the delimiters. +ansible: +- changed-files: + - any-glob-to-any-file: + - '.ansible-lint' + - 'ansible.cfg' + - 'ansible/*' + - 'molecule/*' + +configuration: +- changed-files: + - any-glob-to-any-file: + - '.github/*yml' + - '.gitignore' + - '.gitattributes' + - '.vscode/*' + - '.devcontainer/*' + - '.editorconfig' + - '.yamllint.yml' + - '.ansible-lint' + +docker: +- changed-files: + - any-glob-to-any-file: + - '**/Dockerfile' + - '**/docker-compose.yml' + - '**/docker-compose.yaml' + - '**/docker-compose.test.yml' + +github: +- any: + - changed-files: + - any-glob-to-any-file: + - '.github/*' + - '!.github/workflows/' + +source: +- all: + - changed-files: + - any-glob-to-any-file: 'src/**/*' + - all-globs-to-all-files: '!src/docs/*' + +policy: +- changed-files: + - any-glob-to-any-file: + - '.github/ISSUE_TEMPLATE/*' + - '.github/PULL_TEMPLATE/*' + - 'LICENSE' + - 'SECURITY.md' + +terraform: +- changed-files: + - any-glob-to-any-file: + - 'terraform/*' + - '**/*.tf' + - '**/*.lock.hcl' + +vscode: +- changed-files: + - any-glob-to-any-file: + - '.vscode/*' + feature: -- head-branch: ['^feat/'] # Matches branch names starting with 'feat/' -bugfix: -- head-branch: ['^fix/'] # Matches branch names starting with 'fix/' -documentation: -- head-branch: ['^docs/'] +- head-branch: + - '^(feat)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + +ci-cd: +- head-branch: + - '^(ci)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - '.github/workflows/*' + - '.github/*' + +devops: +- head-branch: + - '^(ci)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - 'deployments/*' + - '.github/workflows/*' + - '.github/*' + - 'terraform/*' + - '**/*.tf' + - '**/*.lock.hcl' + - '**/Dockerfile' + - '**/docker-compose.yml' + - '**/docker-compose.yaml' + - '**/docker-compose.test.yml' + style: -- head-branch: ['^style/'] -refactor: -- head-branch: ['^refactor/'] -test: -- head-branch: ['^test/'] -# - changed-files: -# - any-glob-to-any-file: 'tests/*' -chore: -- head-branch: ['^chore/'] -# - changed-files: -# - any-glob-to-any-file: 'readme.md' -# - any-glob-to-any-file: 'package.json' +- head-branch: + - '^(style)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + +documentation: +- head-branch: + - '^(docs)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - '**/*.md' + - '**/*.rst' + - '**/*.txt' + - docs/** + - guides/* + performance: -- head-branch: ['^perf/'] -ci: -- head-branch: ['^ci/'] -# - changed-files: -# - any-glob-to-any-file: '.github/workflows/*' +- head-branch: + - '^(perf)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + +bug: +- head-branch: + - '^(fix)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + +enhancement: +- head-branch: + - '^(refactor)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - src/* + build: -- head-branch: ['^build/'] -revert: -- head-branch: ['^revert/'] +- head-branch: + - '^(build)(\([a-z ]+\))?\/.' + +dependencies: +- head-branch: + - '^(build)(\([a-z ]+\))?\/.' + +chore: +- head-branch: + - '^(chore)(\([a-z ]+\))?\/.' +- changed-files: + - all-globs-to-all-files: '!src/*' + - all-globs-to-all-files: '!tests/*' + - all-globs-to-all-files: '!.github/*' + +test: +- head-branch: + - '^(test)(\([a-z ]+\))?\/.' +- changed-files: + - any-glob-to-any-file: + - 'test/*' + - 'molecule/*' + - 'docker-compose.test.yml' + +minor: +- head-branch: + - '^(feat)(\([a-z ]+\))?\/.' + +patch: +- head-branch: + - '^(fix)(\([a-z ]+\))?\/.' + - '^(ci)(\([a-z ]+\))?\/.' diff --git a/.github/multi-labeler.yml b/.github/multi-labeler.yml index f4a4e21..317991a 100644 --- a/.github/multi-labeler.yml +++ b/.github/multi-labeler.yml @@ -3,85 +3,85 @@ version: v1 labels: - - label: "feature" - matcher: - title: '^(feat)(\([a-z ]+\))?: .' - commits: '^(feat)(\([a-z ]+\))?: .' - branch: '(feat)(\([a-z ]+\))?\/.' +- label: "feature" + matcher: + title: '^(feat)(\([a-z ]+\))?: .' + commits: '^(feat)(\([a-z ]+\))?: .' + branch: '^(feat)(\([a-z ]+\))?\/.' - - label: "bug" - matcher: - title: '^(fix)(\([a-z ]+\))?: .' - commits: '^(fix)(\([a-z ]+\))?: .' - branch: '(fix)(\([a-z ]+\))?\/.' +- label: "bug" + matcher: + title: '^(fix)(\([a-z ]+\))?: .' + commits: '^(fix)(\([a-z ]+\))?: .' + branch: '^(fix)(\([a-z ]+\))?\/.' - - label: "chore" - matcher: - title: '^(chore)(\([a-z ]+\))?: .' - commits: '^(chore)(\([a-z ]+\))?: .' - branch: '(chore)(\([a-z ]+\))?\/.' +- label: "chore" + matcher: + title: '^(chore)(\([a-z ]+\))?: .' + commits: '^(chore)(\([a-z ]+\))?: .' + branch: '^(chore)(\([a-z ]+\))?\/.' - - label: "documentation" - matcher: - title: '^(docs)(\([a-z ]+\))?: .' - commits: '^(docs)(\([a-z ]+\))?: .' - branch: '(docs)(\([a-z ]+\))?\/.' +- label: "documentation" + matcher: + title: '^(docs)(\([a-z ]+\))?: .' + commits: '^(docs)(\([a-z ]+\))?: .' + branch: '^(docs)(\([a-z ]+\))?\/.' - - label: "devops" - matcher: - title: '^(ci)(\([a-z ]+\))?: .' - commits: '^(ci)(\([a-z ]+\))?: .' - branch: '(ci)(\([a-z ]+\))?\/.' +- label: "devops" + matcher: + title: '^(ci)(\([a-z ]+\))?: .' + commits: '^(ci)(\([a-z ]+\))?: .' + branch: '^(ci)(\([a-z ]+\))?\/.' - - label: "ci/cd" - matcher: - title: '^(ci)(\([a-z ]+\))?: .' - commits: '^(ci)(\([a-z ]+\))?: .' - branch: '(ci)(\([a-z ]+\))?\/.' +- label: "ci/cd" + matcher: + title: '^(ci)(\([a-z ]+\))?: .' + commits: '^(ci)(\([a-z ]+\))?: .' + branch: '^(ci)(\([a-z ]+\))?\/.' - - label: "enhancement" - matcher: - title: '^(refactor)(\([a-z ]+\))?: .' - commits: '^(refactor)(\([a-z ]+\))?: .' - branch: '(refactor)(\([a-z ]+\))?\/.' +- label: "enhancement" + matcher: + title: '^(refactor)(\([a-z ]+\))?: .' + commits: '^(refactor)(\([a-z ]+\))?: .' + branch: '^(refactor)(\([a-z ]+\))?\/.' - - label: "formatting" - matcher: - title: '^(style)(\([a-z ]+\))?: .' - commits: '^(style)(\([a-z ]+\))?: .' - branch: '(style)(\([a-z ]+\))?\/.' +- label: "formatting" + matcher: + title: '^(style)(\([a-z ]+\))?: .' + commits: '^(style)(\([a-z ]+\))?: .' + branch: '^(style)(\([a-z ]+\))?\/.' - - label: "performance" - matcher: - title: '^(perf)(\([a-z ]+\))?: .' - commits: '^(perf)(\([a-z ]+\))?: .' - branch: '(perf)(\([a-z ]+\))?\/.' +- label: "performance" + matcher: + title: '^(perf)(\([a-z ]+\))?: .' + commits: '^(perf)(\([a-z ]+\))?: .' + branch: '^(perf)(\([a-z ]+\))?\/.' - - label: "build" - matcher: - title: '^(build)(\([a-z ]+\))?: .' - commits: '^(build)(\([a-z ]+\))?: .' - branch: '(build)(\([a-z ]+\))?\/.' +- label: "build" + matcher: + title: '^(build)(\([a-z ]+\))?: .' + commits: '^(build)(\([a-z ]+\))?: .' + branch: '^(build)(\([a-z ]+\))?\/.' - - label: "test" - matcher: - title: '^(test)(\([a-z ]+\))?: .' - commits: '^(test)(\([a-z ]+\))?: .' - branch: '(test)(\([a-z ]+\))?\/.' +- label: "test" + matcher: + title: '^(test)(\([a-z ]+\))?: .' + commits: '^(test)(\([a-z ]+\))?: .' + branch: '^(test)(\([a-z ]+\))?\/.' - - label: "dependencies" - matcher: - title: '^build\(deps\): .' - commits: '^build\(deps\): .' +- label: "dependencies" + matcher: + title: '^build\(deps\): .' + commits: '^build\(deps\): .' - - label: "minor" - matcher: - title: '^(feat)(\([a-z ]+\))?: .' - commits: '^(feat)(\([a-z ]+\))?: .' - branch: '(feat)(\([a-z ]+\))?\/.' +- label: "minor" + matcher: + title: '^(feat)(\([a-z ]+\))?: .' + commits: '^(feat)(\([a-z ]+\))?: .' + branch: '^(feat)(\([a-z ]+\))?\/.' - - label: "patch" - matcher: - title: '^(fix)(\([a-z ]+\))?: .' - commits: '^(fix)(\([a-z ]+\))?: .' - branch: '(fix)(\([a-z ]+\))?\/.' \ No newline at end of file +- label: "patch" + matcher: + title: '^(fix)(\([a-z ]+\))?: .' + commits: '^(fix)(\([a-z ]+\))?: .' + branch: '^(fix)(\([a-z ]+\))?\/.' diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 938749a..6c8f690 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -68,71 +68,38 @@ categories: # https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax # Auto-labeler: Assign labels based on branch names or PR titles that follow Conventional Commits autolabeler: -- label: 'feature' +- label: "chore" branch: - - '/feat\/.+/' # Matches branch names starting with feat/ + - '^(chore)(\([a-z ]+\))?\/.' title: - - '/feat\: .+/' # Matches PR titles starting with feat: - -- label: 'bugfix' - branch: - - '/fix\/.+/' # Matches branch names starting with fix/ - title: - - '/fix\: .+/' # Matches PR titles starting with fix: - -- label: 'documentation' - branch: - - '/docs\/.+/' # Matches branch names starting with docs/ - title: - - '/docs\: .+/' # Matches PR titles starting with docs: - -- label: 'style' - branch: - - '/style\/.+/' # Matches branch names starting with style/ - title: - - '/style\: .+/' # Matches PR titles starting with style: - -- label: 'refactor' + - '^(chore)(\([a-z ]+\))?: .' +- label: "bug" branch: - - '/refactor\/.+/' # Matches branch names starting with refactor/ + - '^(fix)(\([a-z ]+\))?\/.' title: - - '/refactor\: .+/' # Matches PR titles starting with refactor: - -- label: 'test' - branch: - - '/test\/.+/' # Matches branch names starting with test/ - title: - - '/test\: .+/' # Matches PR titles starting with test: - -- label: 'chore' - branch: - - '/chore\/.+/' # Matches branch names starting with chore/ - title: - - '/chore\: .+/' # Matches PR titles starting with chore: - -- label: 'performance' + - '^(fix)(\([a-z ]+\))?: .' +- label: "feature" branch: - - '/perf\/.+/' # Matches branch names starting with perf/ + - '^(feat)(\([a-z ]+\))?\/.' title: - - '/perf\: .+/' # Matches PR titles starting with perf: - -- label: 'ci' + - '^(feat)(\([a-z ]+\))?: .' +- label: "ci/cd" branch: - - '/ci\/.+/' # Matches branch names starting with ci/ + - '^(ci)(\([a-z ]+\))?\/.' title: - - '/ci\: .+/' # Matches PR titles starting with ci: - -- label: 'build' + - '^(ci)(\([a-z ]+\))?: .' +- label: "minor" branch: - - '/build\/.+/' # Matches branch names starting with build/ + - '^(feat)(\([a-z ]+\))?\/.' title: - - '/build\: .+/' # Matches PR titles starting with build: - -- label: 'revert' + - '^(feat)(\([a-z ]+\))?: .' +- label: "patch" branch: - - '/revert\/.+/' # Matches branch names starting with revert/ + - '^(fix)(\([a-z ]+\))?\/.' + - '^(ci)(\([a-z ]+\))?\/.' title: - - '/revert\: .+/' # Matches PR titles starting with revert: + - '^(fix)(\([a-z ]+\))?: .' + - '^(ci)(\([a-z ]+\))?: .' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index aa56de7..75a2fc8 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -22,7 +22,11 @@ jobs: - uses: actions/checkout@v3 - name: Conventional Commits Check - uses: webiny/action-conventional-commits@v1.3.0 + uses: amannn/action-semantic-pull-request@v5 + if: always() + id: check-pull-request-title-conventional-commits + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Setup Node.js uses: actions/setup-node@v3 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 53bd042..d8f3efc 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -2,13 +2,9 @@ name: Auto Labeler on: pull_request: - types: - - opened - - synchronize - - reopened - - labeled - - unlabeled - - edited + types: [opened, edited, synchronize, ready_for_review] + + pull_request_target: jobs: auto-labeler: @@ -19,16 +15,12 @@ jobs: # otherwise, read permission is required at least pull-requests: write contents: read - statuses: write - checks: write + ## just for multi-labeler + # statuses: write + # checks: write steps: - # - name: Apply labels based on PR title and branch name - # uses: actions/labeler@v5 - # with: - # repo-token: ${{ secrets.GITHUB_TOKEN }} - # configuration-path: ".github/labeler.yml" - + ## doesn't work # - uses: release-drafter/release-drafter@v6 # with: # config-name: release-drafter.yml @@ -36,15 +28,23 @@ jobs: # env: # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: fuxingloh/multi-labeler@v1 - name: conventional-commits-pull-request-labeler + # - uses: fuxingloh/multi-labeler@v1 + # name: conventional-commits-pull-request-labeler + # with: + # github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' + # config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' + + # https://github.com/actions/labeler + - uses: actions/labeler@v5 with: - github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' - config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true + # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs + # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow - name: check-conventional-commits-labels uses: docker://agilepathway/pull-request-label-checker:latest if: success() with: - any_of: feature,bug,enhancement,refactor,deprecated,security,documentation,build,ci/cd,chore,performance,formatting,dependencies,test,major,minor,patch + any_of: feature,bug,enhancement,refactor,deprecated,security,documentation,build,ci/cd,devops,chore,performance,formatting,dependencies,test,major,minor,patch repo_token: ${{ secrets.GITHUB_TOKEN }} From 74c087ea2b8e97d241d831b3f46208507d7a5305 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Tue, 17 Sep 2024 00:27:32 +0330 Subject: [PATCH 16/21] chore: some change --- .github/labeler.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index cb48fd9..3314c29 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -74,10 +74,10 @@ feature: ci-cd: - head-branch: - '^(ci)(\([a-z ]+\))?\/.' -- changed-files: - - any-glob-to-any-file: - - '.github/workflows/*' - - '.github/*' +# - changed-files: +# - any-glob-to-any-file: +# - '.github/workflows/*' +# - '.github/*' devops: - head-branch: From babb3028bf7ea9f2914875cbccf3cb356a02a29e Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Tue, 17 Sep 2024 00:30:15 +0330 Subject: [PATCH 17/21] ci: some changes --- .github/labeler.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index 3314c29..cb48fd9 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -74,10 +74,10 @@ feature: ci-cd: - head-branch: - '^(ci)(\([a-z ]+\))?\/.' -# - changed-files: -# - any-glob-to-any-file: -# - '.github/workflows/*' -# - '.github/*' +- changed-files: + - any-glob-to-any-file: + - '.github/workflows/*' + - '.github/*' devops: - head-branch: From 5b29cc356c1c4133b2627f3f8875195f147959b5 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Tue, 17 Sep 2024 01:06:08 +0330 Subject: [PATCH 18/21] ci: some change --- .github/release-drafter.yml | 73 ++++++++++++++++++++++------------- .github/workflows/labeler.yml | 28 +++++++------- 2 files changed, 60 insertions(+), 41 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 6c8f690..e91aea6 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -67,39 +67,58 @@ categories: # Using regex for defining rules - https://regexr.com/ # https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax # Auto-labeler: Assign labels based on branch names or PR titles that follow Conventional Commits +# autolabeler: +# - label: "chore" +# branch: +# - '^(chore)(\([a-z ]+\))?\/.' +# title: +# - '^(chore)(\([a-z ]+\))?: .' +# - label: "bug" +# branch: +# - '^(fix)(\([a-z ]+\))?\/.' +# title: +# - '^(fix)(\([a-z ]+\))?: .' +# - label: "feature" +# branch: +# - '^(feat)(\([a-z ]+\))?\/.' +# title: +# - '^(feat)(\([a-z ]+\))?: .' +# - label: "ci/cd" +# branch: +# - '^(ci)(\([a-z ]+\))?\/.' +# title: +# - '^(ci)(\([a-z ]+\))?: .' +# - label: "minor" +# branch: +# - '^(feat)(\([a-z ]+\))?\/.' +# title: +# - '^(feat)(\([a-z ]+\))?: .' +# - label: "patch" +# branch: +# - '^(fix)(\([a-z ]+\))?\/.' +# - '^(ci)(\([a-z ]+\))?\/.' +# title: +# - '^(fix)(\([a-z ]+\))?: .' +# - '^(ci)(\([a-z ]+\))?: .' autolabeler: -- label: "chore" +- label: 'chore' + files: + - '*.md' branch: - - '^(chore)(\([a-z ]+\))?\/.' - title: - - '^(chore)(\([a-z ]+\))?: .' -- label: "bug" - branch: - - '^(fix)(\([a-z ]+\))?\/.' - title: - - '^(fix)(\([a-z ]+\))?: .' -- label: "feature" + - '/docs{0,1}\/.+/' +- label: 'bug' branch: - - '^(feat)(\([a-z ]+\))?\/.' + - '/fix\/.+/' title: - - '^(feat)(\([a-z ]+\))?: .' -- label: "ci/cd" + - '/fix/i' +- label: 'enhancement' branch: - - '^(ci)(\([a-z ]+\))?\/.' - title: - - '^(ci)(\([a-z ]+\))?: .' -- label: "minor" + - '/feature\/.+/' +- label: 'ci-cd' branch: - - '^(feat)(\([a-z ]+\))?\/.' - title: - - '^(feat)(\([a-z ]+\))?: .' -- label: "patch" - branch: - - '^(fix)(\([a-z ]+\))?\/.' - - '^(ci)(\([a-z ]+\))?\/.' - title: - - '^(fix)(\([a-z ]+\))?: .' - - '^(ci)(\([a-z ]+\))?: .' + - '/ci\/.+/' + body: + - '/JIRA-[0-9]{1,4}/' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index d8f3efc..c832c64 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -20,13 +20,13 @@ jobs: # checks: write steps: - ## doesn't work - # - uses: release-drafter/release-drafter@v6 - # with: - # config-name: release-drafter.yml - # disable-releaser: true # releaser mode is disabled. - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # doesn't work + - uses: release-drafter/release-drafter@v6 + with: + config-name: release-drafter.yml + disable-releaser: true # releaser mode is disabled. + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - uses: fuxingloh/multi-labeler@v1 # name: conventional-commits-pull-request-labeler @@ -34,14 +34,14 @@ jobs: # github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' # config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' - # https://github.com/actions/labeler - - uses: actions/labeler@v5 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - sync-labels: true + # # https://github.com/actions/labeler + # - uses: actions/labeler@v5 + # with: + # repo-token: "${{ secrets.GITHUB_TOKEN }}" + # sync-labels: true - # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs - # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow + # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs + # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow - name: check-conventional-commits-labels uses: docker://agilepathway/pull-request-label-checker:latest if: success() From 28b496ddfa5863243874bd75a0419df0249ba67f Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Tue, 17 Sep 2024 01:10:04 +0330 Subject: [PATCH 19/21] ci: some ci change --- .github/release-drafter.yml | 73 +++++++++++++---------------------- .github/workflows/labeler.yml | 28 +++++++------- 2 files changed, 41 insertions(+), 60 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index e91aea6..6c8f690 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -67,58 +67,39 @@ categories: # Using regex for defining rules - https://regexr.com/ # https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax # Auto-labeler: Assign labels based on branch names or PR titles that follow Conventional Commits -# autolabeler: -# - label: "chore" -# branch: -# - '^(chore)(\([a-z ]+\))?\/.' -# title: -# - '^(chore)(\([a-z ]+\))?: .' -# - label: "bug" -# branch: -# - '^(fix)(\([a-z ]+\))?\/.' -# title: -# - '^(fix)(\([a-z ]+\))?: .' -# - label: "feature" -# branch: -# - '^(feat)(\([a-z ]+\))?\/.' -# title: -# - '^(feat)(\([a-z ]+\))?: .' -# - label: "ci/cd" -# branch: -# - '^(ci)(\([a-z ]+\))?\/.' -# title: -# - '^(ci)(\([a-z ]+\))?: .' -# - label: "minor" -# branch: -# - '^(feat)(\([a-z ]+\))?\/.' -# title: -# - '^(feat)(\([a-z ]+\))?: .' -# - label: "patch" -# branch: -# - '^(fix)(\([a-z ]+\))?\/.' -# - '^(ci)(\([a-z ]+\))?\/.' -# title: -# - '^(fix)(\([a-z ]+\))?: .' -# - '^(ci)(\([a-z ]+\))?: .' autolabeler: -- label: 'chore' - files: - - '*.md' +- label: "chore" branch: - - '/docs{0,1}\/.+/' -- label: 'bug' + - '^(chore)(\([a-z ]+\))?\/.' + title: + - '^(chore)(\([a-z ]+\))?: .' +- label: "bug" + branch: + - '^(fix)(\([a-z ]+\))?\/.' + title: + - '^(fix)(\([a-z ]+\))?: .' +- label: "feature" branch: - - '/fix\/.+/' + - '^(feat)(\([a-z ]+\))?\/.' title: - - '/fix/i' -- label: 'enhancement' + - '^(feat)(\([a-z ]+\))?: .' +- label: "ci/cd" branch: - - '/feature\/.+/' -- label: 'ci-cd' + - '^(ci)(\([a-z ]+\))?\/.' + title: + - '^(ci)(\([a-z ]+\))?: .' +- label: "minor" branch: - - '/ci\/.+/' - body: - - '/JIRA-[0-9]{1,4}/' + - '^(feat)(\([a-z ]+\))?\/.' + title: + - '^(feat)(\([a-z ]+\))?: .' +- label: "patch" + branch: + - '^(fix)(\([a-z ]+\))?\/.' + - '^(ci)(\([a-z ]+\))?\/.' + title: + - '^(fix)(\([a-z ]+\))?: .' + - '^(ci)(\([a-z ]+\))?: .' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index c832c64..d8f3efc 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -20,13 +20,13 @@ jobs: # checks: write steps: - # doesn't work - - uses: release-drafter/release-drafter@v6 - with: - config-name: release-drafter.yml - disable-releaser: true # releaser mode is disabled. - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ## doesn't work + # - uses: release-drafter/release-drafter@v6 + # with: + # config-name: release-drafter.yml + # disable-releaser: true # releaser mode is disabled. + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # - uses: fuxingloh/multi-labeler@v1 # name: conventional-commits-pull-request-labeler @@ -34,14 +34,14 @@ jobs: # github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' # config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' - # # https://github.com/actions/labeler - # - uses: actions/labeler@v5 - # with: - # repo-token: "${{ secrets.GITHUB_TOKEN }}" - # sync-labels: true + # https://github.com/actions/labeler + - uses: actions/labeler@v5 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" + sync-labels: true - # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs - # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow + # https://docs.github.com/en/actions/using-workflows/about-workflows#creating-dependent-jobs + # https://docs.github.com/en/actions/using-jobs/using-jobs-in-a-workflow - name: check-conventional-commits-labels uses: docker://agilepathway/pull-request-label-checker:latest if: success() From 1d18ee5da7fee06f09daf98f1c8978f3608c1934 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Tue, 17 Sep 2024 01:12:28 +0330 Subject: [PATCH 20/21] ci: some ci change --- .github/labeler.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/labeler.yml b/.github/labeler.yml index cb48fd9..6b862f4 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -67,6 +67,7 @@ vscode: feature: - head-branch: - '^(feat)(\([a-z ]+\))?\/.' + - '^(feature)(\([a-z ]+\))?\/.' - changed-files: - any-glob-to-any-file: - src/* From 806fa6977af49ece653c7b1d8d5af69588ebe398 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Tue, 17 Sep 2024 01:24:39 +0330 Subject: [PATCH 21/21] ci: some ci changes --- .github/multi-labeler.yml | 4 ++-- .github/release-drafter.yml | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/multi-labeler.yml b/.github/multi-labeler.yml index 317991a..84dd639 100644 --- a/.github/multi-labeler.yml +++ b/.github/multi-labeler.yml @@ -33,7 +33,7 @@ labels: commits: '^(ci)(\([a-z ]+\))?: .' branch: '^(ci)(\([a-z ]+\))?\/.' -- label: "ci/cd" +- label: "ci-cd" matcher: title: '^(ci)(\([a-z ]+\))?: .' commits: '^(ci)(\([a-z ]+\))?: .' @@ -45,7 +45,7 @@ labels: commits: '^(refactor)(\([a-z ]+\))?: .' branch: '^(refactor)(\([a-z ]+\))?\/.' -- label: "formatting" +- label: "style" matcher: title: '^(style)(\([a-z ]+\))?: .' commits: '^(style)(\([a-z ]+\))?: .' diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 6c8f690..dc2b393 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -18,6 +18,7 @@ categories: - title: ๐Ÿš€ Features labels: - feature + - feat - title: โ™ป๏ธ Enhancement labels: - enhancement @@ -29,9 +30,12 @@ categories: - title: ๐Ÿ‘ท CI labels: - ci + - ci-cd + - devops - title: โš ๏ธ Breaking Changes labels: - breaking-changes + - major - title: โ›”๏ธ Deprecated labels: - deprecated @@ -41,6 +45,9 @@ categories: - title: ๐Ÿ” Security labels: - security +- title: ๐ŸŽจ Style & Formatting + labels: + - style - title: ๐Ÿงช Test labels: - test @@ -51,6 +58,7 @@ categories: - title: ๐Ÿงฉ Dependency Updates labels: - deps + - build - dependencies - title: ๐Ÿงฐ Maintenance label: 'chore' @@ -59,7 +67,6 @@ categories: - title: ๐Ÿšฉ Other changes ## putting no labels pr to `Other Changes` category with no label - https://github.com/release-drafter/release-drafter/issues/139#issuecomment-480473934 - # https://www.trywilco.com/post/wilco-ci-cd-github-heroku # https://github.com/release-drafter/release-drafter#autolabeler # https://github.com/fuxingloh/multi-labeler @@ -83,7 +90,12 @@ autolabeler: - '^(feat)(\([a-z ]+\))?\/.' title: - '^(feat)(\([a-z ]+\))?: .' -- label: "ci/cd" +- label: "style" + branch: + - '^(style)(\([a-z ]+\))?\/.' + title: + - '^(style)(\([a-z ]+\))?: .' +- label: "ci-cd" branch: - '^(ci)(\([a-z ]+\))?\/.' title: