feat(PR): add conditions to label pr (#2532)

* chore: update conventional-labeler action to version 2.0.0

* chore: add 'bug' label to fix category in release.yml

* chore(conventional-labels.yml): add 'Validate PR' job to validate pull requests before labeling them
chore(conventional-labels.yml): add 'Label PR' job to label pull requests after validation is successful

* chore(conventional-labels.yml): update conditional statement in Label PR job to exclude Bot users from linting and only run if PR validation is successful

* chore(conventional-labels.yml): update type_labels mapping to align with conventional commit keywords for better labeling in GitHub actions.

* fix(conventional-labels.yml): run workflow only on editing the PR

* chore(conventional-labels.yml): do not require an issue reference
This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-07-04 12:11:37 -03:00 committed by GitHub
commit f2d949b64e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 5 deletions

1
.github/release.yml vendored
View file

@ -12,6 +12,7 @@ changelog:
description: Bug fixes and patches
labels:
- fix
- bug
- title: 📝 Documentation Updates
description: Changes to documentation
labels:

View file

@ -3,22 +3,29 @@
name: Label PRs with Conventional Commits
on:
pull_request_target:
types: [ opened, edited , synchronize]
types: [ opened, edited , reopened]
jobs:
validate-pr:
name: Validate PR
runs-on: ubuntu-latest
outputs:
validate_output: ${{ steps.validate.outputs }}
steps:
- name: Validate the pull request
id: validate
uses: Namchee/conventional-pr@v0.15.4
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
verbose: true
issue: false
label:
needs: validate-pr
name: Label PR
runs-on: ubuntu-latest
name: Lint PR
if: ${{ github.event.pull_request.user.type != 'Bot' && needs.validate-pr.outputs.validate_output == 'true' }}
steps:
- name: label
uses: action-runner/conventional-labeler@v1
- uses: bcoe/conventional-release-labels@v1
with:
access_token: ${{ secrets.GITHUB_TOKEN }}
type_labels: '{"feat": "enhancement","fix": "bug","docs": "documentation","style": "style","refactor": "refactor","perf": "performance","test": "test","chore": "chore","build": "build"}'