chore: Bump version #21
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pull Request Labeler | |
on: | |
pull_request: | |
types: [ opened ] | |
jobs: | |
labeler: | |
permissions: | |
pull-requests: write | |
runs-on: ubuntu-latest | |
name: Add labels | |
strategy: | |
matrix: | |
label: | |
- { prefix: "fix:", name: "bug" } | |
- { prefix: "chore:", name: "chore" } | |
- { prefix: "doc:", name: "documentation" } | |
- { prefix: "feat:", name: "enhancement" } | |
- { prefix: "ex:", name: "example" } | |
- { prefix: "revert:", name: "revert" } | |
- { prefix: "test:", name: "test" } | |
- { prefix: "dep:", name: "dependency" } | |
- { prefix: "act:", name: "action" } | |
steps: | |
- name: Add ${{ matrix.label.name }} label | |
uses: actions-ecosystem/action-add-labels@v1 | |
if: ${{ startsWith(github.event.pull_request.title, matrix.label.prefix) }} | |
with: | |
labels: ${{ matrix.label.name }} | |
validator: | |
needs: labeler | |
runs-on: ubuntu-latest | |
name: Close PR if no label was added | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check if no label was added | |
run: | | |
labels=$(gh pr view ${{ github.event.pull_request.number }} --json labels --jq '.labels[].name') | |
if [ -z "$labels" ]; then | |
echo "No labels were added, closing the pull request." | |
gh pr close ${{ github.event.pull_request.number }} --comment "Closing PR: No valid prefix found in the title." | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |