From 75cf39643f8b58316171974c35d4c2f30eb09373 Mon Sep 17 00:00:00 2001 From: Mehdi Hadeli Date: Tue, 17 Sep 2024 00:36:33 +0200 Subject: [PATCH] =?UTF-8?q?ci:=20=F0=9F=91=B7=20enhance=20some=20github=20?= =?UTF-8?q?actions=20pipeline=20(#17)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/labeler.yml | 170 +++++++++++++++++++++ .github/multi-labeler.yml | 138 ++++++++--------- .github/release-drafter.yml | 170 +++++++++++---------- .github/release.yml | 90 ++++++----- .github/workflows/ci.yml | 65 ++++---- .github/workflows/conventional-commits.yml | 57 ------- .github/workflows/first-interaction.yml | 26 ---- .github/workflows/labeler.yml | 54 ++++--- .github/workflows/release-drafter.yml | 5 +- 9 files changed, 451 insertions(+), 324 deletions(-) create mode 100644 .github/labeler.yml delete mode 100644 .github/workflows/conventional-commits.yml delete mode 100644 .github/workflows/first-interaction.yml diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..6b862f4 --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,170 @@ +# 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. + +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)(\([a-z ]+\))?\/.' + - '^(feature)(\([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)(\([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)(\([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)(\([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..84dd639 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: "style" + 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 d372adf..c26a7f4 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -15,47 +15,57 @@ template: | $CHANGES **Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION categories: - - title: ๐Ÿš€ Features - labels: - - feature - - title: โ™ป๏ธ Enhancement - labels: - - enhancement - - refactor - - title: ๐Ÿ› Bug Fixes - labels: - - fix - - bug - - title: ๐Ÿ‘ท CI - labels: - - ci - - title: โš ๏ธ Breaking Changes - labels: - - breaking-changes - - title: โ›”๏ธ Deprecated - labels: - - deprecated - - title: ๐Ÿ—‘ Removed - labels: - - removed - - title: ๐Ÿ” Security - labels: - - security - - title: ๐Ÿ“„ Documentation - labels: - - docs - - documentation - - title: ๐Ÿงฉ Dependency Updates - labels: - - deps - - dependencies - - title: ๐Ÿงฐ Maintenance - label: 'chore' - - title: ๐Ÿงบ Miscellaneous #Everything except ABAP - label: misc - - 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 - +- title: ๐Ÿš€ Features + labels: + - feature + - feat +- title: โ™ป๏ธ Enhancement + labels: + - enhancement + - refactor +- title: ๐Ÿ› Bug Fixes + labels: + - fix + - bug +- title: ๐Ÿ‘ท CI + labels: + - ci + - ci-cd + - devops +- title: โš ๏ธ Breaking Changes + labels: + - breaking-changes + - major +- title: โ›”๏ธ Deprecated + labels: + - deprecated +- title: ๐Ÿ—‘ Removed + labels: + - removed +- title: ๐Ÿ” Security + labels: + - security +- title: ๐ŸŽจ Style & Formatting + labels: + - style +- title: ๐Ÿงช Test + labels: + - test +- title: ๐Ÿ“„ Documentation + labels: + - docs + - documentation +- title: ๐Ÿงฉ Dependency Updates + labels: + - deps + - build + - dependencies +- title: ๐Ÿงฐ Maintenance + label: 'chore' +- title: ๐Ÿงบ Miscellaneous #Everything except ABAP + label: misc +- 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 @@ -63,53 +73,59 @@ 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 ]+\))?: .' +- 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: "style" + branch: + - '^(style)(\([a-z ]+\))?\/.' + title: + - '^(style)(\([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 ]+\))?: .' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. version-resolver: major: labels: - - breaking-changes + - breaking-changes minor: labels: - - minor + - minor patch: labels: - - patch + - patch default: patch exclude-labels: - - skip-changelog +- skip-changelog diff --git a/.github/release.yml b/.github/release.yml index b209cf1..94fcce9 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -7,41 +7,57 @@ changelog: exclude: labels: - - ignore-for-release + - ignore-for-release categories: - - title: ๐Ÿš€ Features - labels: - - feature - - title: ๐Ÿ› Bug Fixes - labels: - - fix - - bug - - title: โ™ป๏ธ Changes - labels: - - changed - - enhancement - - refactor - - title: โ›”๏ธ Deprecated - labels: - - deprecated - - title: ๐Ÿ—‘ Removed - labels: - - removed - - title: ๐Ÿ” Security - labels: - - security - - title: ๐Ÿ“„ Documentation - labels: - - docs - - documentation - - title: ๐Ÿงฉ Dependency Updates - labels: - - deps - - dependencies - - title: ๐Ÿงฐ Maintenance - label: 'chore' - - title: ๐Ÿงบ Miscellaneous #Everything except ABAP - label: misc - - title: Other Changes - labels: - - "*" + - title: ๐Ÿš€ Features + labels: + - feature + - feat + - title: โ™ป๏ธ Enhancement + labels: + - enhancement + - refactor + - title: ๐Ÿ› Bug Fixes + labels: + - fix + - bug + - title: ๐Ÿ‘ท CI + labels: + - ci + - ci-cd + - devops + - title: โš ๏ธ Breaking Changes + labels: + - breaking-changes + - major + - title: โ›”๏ธ Deprecated + labels: + - deprecated + - title: ๐Ÿ—‘ Removed + labels: + - removed + - title: ๐Ÿ” Security + labels: + - security + - title: ๐ŸŽจ Style & Formatting + labels: + - style + - title: ๐Ÿงช Test + labels: + - test + - title: ๐Ÿ“„ Documentation + labels: + - docs + - documentation + - title: ๐Ÿงฉ Dependency Updates + labels: + - deps + - build + - dependencies + - title: ๐Ÿงฐ Maintenance + label: 'chore' + - title: ๐Ÿงบ Miscellaneous #Everything except ABAP + label: misc + - title: Other Changes + labels: + - "*" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dc8251..107c3cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,45 +2,40 @@ name: CI on: push: - branches: - - dev - - main - - fix/* - - build/* - - test/* - - ci/* - - feat/* + branches: + - "main" pull_request: - branches: - - dev - - main + branches: + - "main" jobs: - - build-test: + pre-checks: + name: Pre-Checks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - - name: setup go - uses: actions/setup-go@v3 - with: - go-version: 1.18 + - uses: actions/checkout@v3 - - name: build - run: go build -v ./... + - name: Conventional Commits Check + uses: amannn/action-semantic-pull-request@v5 + # Only run on pull request events + if: github.event_name == 'pull_request' + id: check-pull-request-title-conventional-commits + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: test - run: go test -v -coverprofile=profile.cov ./... + - name: setup go + uses: actions/setup-go@v3 + with: + go-version: 1.18 - - name: send coverage - uses: shogo82148/actions-goveralls@v1 - with: - path-to-profile: profile.cov + - name: lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest - lint: - name: lint + build-test: runs-on: ubuntu-latest + needs: pre-checks steps: - uses: actions/checkout@v3 @@ -49,7 +44,13 @@ jobs: with: go-version: 1.18 - - name: lint - uses: golangci/golangci-lint-action@v3 + - name: build + run: go build -v ./... + + - name: test + run: go test -v -coverprofile=profile.cov ./... + + - name: send coverage + uses: shogo82148/actions-goveralls@v1 with: - version: latest + path-to-profile: profile.cov diff --git a/.github/workflows/conventional-commits.yml b/.github/workflows/conventional-commits.yml deleted file mode 100644 index 1d5ae2a..0000000 --- a/.github/workflows/conventional-commits.yml +++ /dev/null @@ -1,57 +0,0 @@ -# https://github.com/amannn/action-semantic-pull-request -# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/configuring-commit-squashing-for-pull-requests -# Linting workflow: https://github.com/rhysd/actionlint - -name: Conventional Commits - -on: - pull_request: - types: - - opened - - synchronize - - reopened - - labeled - - unlabeled - - edited - - ready_for_review - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true - - # https://github.com/amannn/action-semantic-pull-request -permissions: - pull-requests: read - -jobs: - conventional-commits: - runs-on: ubuntu-latest - steps: - - name: Check Pull Request Title Conventional Commits - uses: amannn/action-semantic-pull-request@v5 - if: always() - id: check-pull-request-title-conventional-commits - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # Comments the error message from the above lint_pr_title action - - if: ${{ always() && steps.check-pull-request-title-conventional-commits.outputs.error_message != null}} - name: Comment on PR - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: pr-title-lint-error - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - message: | - We require all PRs to follow [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - More details ๐Ÿ‘‡๐Ÿผ - ``` - ${{ steps.check-pull-request-title-conventional-commits.outputs.error_message}} - ``` - # deletes the error comment if the title is correct - - if: ${{ steps.check-pull-request-title-conventional-commits.outputs.error_message == null }} - name: delete the comment - uses: marocchino/sticky-pull-request-comment@v2 - with: - header: pr-title-lint-error - delete: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/first-interaction.yml b/.github/workflows/first-interaction.yml deleted file mode 100644 index 7498806..0000000 --- a/.github/workflows/first-interaction.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: First interaction -on: - pull_request_target: - types: - - opened - issues: - types: - - opened - -jobs: - first-interaction: - runs-on: ubuntu-latest - name: First interaction - - # https://github.com/actions/first-interaction/issues/10#issuecomment-1278292860 - permissions: - contents: read - issues: write - pull-requests: write - - steps: - - uses: actions/first-interaction@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: "Welcome to go-mediatr. Thank you ${{ github.event.pull_request.user.login }} for reporting your first issue. Please check out our [contributor guide](https://github.com/mehdihadeli/go-mediatr/blob/main/CONTRIBUTION.md)." - pr-message: "Thank you ${{ github.event.pull_request.user.login }} for your first pull request to go-mediatr repository. Please check out our [contributors guide](https://github.com/mehdihadeli/go-ecommerce-microservices/blob/main/CONTRIBUTION.md)." diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 8711c92..d8f3efc 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,33 +1,44 @@ -name: "Pull Request Labeler" +name: Auto Labeler on: pull_request: - types: [ opened, edited, synchronize, ready_for_review ] + types: [opened, edited, synchronize, ready_for_review] + + pull_request_target: jobs: - auto-labeling: + auto-labeler: + name: 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 + # write permission is required for autolabeler + # otherwise, read permission is required at least pull-requests: write - statuses: write - checks: write - + contents: read + ## just for multi-labeler + # statuses: write + # checks: write + steps: - - 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' + ## 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 + # with: + # github-token: ${{secrets.GITHUB_TOKEN}} # optional, default to '${{ github.token }}' + # config-path: .github/multi-labeler.yml # optional, default to '.github/labeler.yml' - # - uses: release-drafter/release-drafter@v5 - # name: release-drafter auto labeler - # with: - # config-name: release-drafter.yml - # disable-releaser: true # only run auto-labeler for PRs - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # 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 @@ -35,6 +46,5 @@ jobs: 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 + 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 }} - diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 112ffa1..5bac388 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -15,13 +15,10 @@ 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@v5 + uses: release-drafter/release-drafter@v6 id: semantic with: config-name: release-drafter.yml