Skip to content

Commit

Permalink
feat: add label-pr action
Browse files Browse the repository at this point in the history
  • Loading branch information
normal-wls committed Sep 6, 2024
1 parent 5e80c3c commit 6129d7d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/label-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Label PR based on title"

on:
pull_request:
types: [opened, edited, reopened]

jobs:
label-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Label PR
run: |
PR_TITLE="${{ github.event.pull_request.title }}"
if [[ "$PR_TITLE" == "fix:"* ]]; then
gh pr edit ${{ github.event.pull_request.number }} --add-label bugfix
elif [[ "$PR_TITLE" == "feat:"* ]]; then
gh pr edit ${{ github.event.pull_request.number }} --add-label feature
else
echo "No label with this title: $PR_TITLE"
fi
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}

0 comments on commit 6129d7d

Please sign in to comment.