-
-
Notifications
You must be signed in to change notification settings - Fork 10
43 lines (36 loc) · 1.08 KB
/
validate-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
31
32
33
34
35
36
37
38
39
40
41
42
43
name: "Validate and Update PR Title"
on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize
permissions:
pull-requests: write
jobs:
main:
name: Validate and Update PR title
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '16'
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
Please ensure that the subject doesn't start with an uppercase character.
- name: Install devmoji
run: npm install -g devmoji
- name: Update PR title with emoji
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
NEW_TITLE=$(echo "$PR_TITLE" | devmoji --format shortcode)
gh pr edit ${{ github.event.pull_request.number }} --title "$NEW_TITLE"