-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
40 lines (35 loc) · 1.16 KB
/
label-issue.yml
File metadata and controls
40 lines (35 loc) · 1.16 KB
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
31
32
33
34
35
36
37
38
39
40
name: Add Labels
on:
pull_request_target:
types: [ opened, edited, synchronize ]
jobs:
check-title:
runs-on: ubuntu-latest
steps:
- name: Check PR title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
echo "Checking PR Title: '$PR_TITLE'"
if [[ ! "$PR_TITLE" =~ ^Answer: ]]; then
echo "❌ PR title should start with 'Answer:[#challenge number]'"
echo "### ❌ PR title should start with 'Answer:[#challenge number]'" >> $GITHUB_STEP_SUMMARY
exit 1
else
echo "✅ PR title format is correct."
echo "### ✅ PR title format is correct." >> $GITHUB_STEP_SUMMARY
fi
add_labels:
runs-on: ubuntu-latest
if: ${{ startsWith(github.event.pull_request.title, 'Answer') }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Install dependencies
run: pnpm add @actions/core @actions/github
- name: Add labels
uses: ./.github/github-action/
with:
github_token: ${{ secrets.GITHUB_TOKEN }}