Skip to content

Commit 6eb9a26

Browse files
committed
fix(): github action
1 parent 541d1e6 commit 6eb9a26

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/label-issue.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ on:
55
types: [ opened, edited ]
66

77
jobs:
8+
check-title:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check PR title
12+
env:
13+
PR_TITLE: ${{ github.event.pull_request.title }}
14+
run: |
15+
echo "Checking PR Title: '$PR_TITLE'"
16+
if [[ ! "$PR_TITLE" =~ ^Answer: ]]; then
17+
echo "❌ PR title should start with 'Answer:[#challenge number]'"
18+
echo "### ❌ PR title should start with 'Answer:[#challenge number]'" >> $GITHUB_STEP_SUMMARY
19+
exit 1
20+
else
21+
echo "✅ PR title format is correct."
22+
echo "### ✅ PR title format is correct." >> $GITHUB_STEP_SUMMARY
23+
fi
824
add_labels:
925
runs-on: ubuntu-latest
1026
if: ${{ startsWith(github.event.pull_request.title, 'Answer') }}
@@ -19,11 +35,3 @@ jobs:
1935
uses: ./.github/github-action/
2036
with:
2137
github_token: ${{ secrets.GITHUB_TOKEN }}
22-
wrong_labels:
23-
runs-on: ubuntu-latest
24-
if: ${{ !startsWith(github.event.pull_request.title, 'Answer') }}
25-
steps:
26-
- name: Set the value in bash
27-
id: step_one
28-
run: |
29-
echo "::error PR title should start with Answer:[number of challenge]" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)