-
Notifications
You must be signed in to change notification settings - Fork 4
30 lines (27 loc) · 1.04 KB
/
label-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
name: "Label PR based on title"
on:
- pull_request_target
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
elif [[ "$PR_TITLE" == "docs:"* ]]; then
gh pr edit ${{ github.event.pull_request.number }} --add-label optimization
elif [[ "$PR_TITLE" == "refactor:"* ]]; then
gh pr edit ${{ github.event.pull_request.number }} --add-label feature
elif [[ "$PR_TITLE" == "perf:"* ]]; then
gh pr edit ${{ github.event.pull_request.number }} --add-label optimization
else
echo "No label with this title: $PR_TITLE"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}