-
Notifications
You must be signed in to change notification settings - Fork 18
41 lines (34 loc) · 946 Bytes
/
on-pr-to-main.yml
File metadata and controls
41 lines (34 loc) · 946 Bytes
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
name: '➕ Pull Request'
permissions:
contents: read
pull-requests: write
on:
pull_request:
types:
- opened
- edited
- reopened
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_LABEL: 'invalid_PR_title'
jobs:
lint-pr:
name: Lint pull request title
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Checkout current PR
run: gh pr checkout $GITHUB_HEAD_REF
- name: Create Label
continue-on-error: true
run: gh label create ${{ env.PR_LABEL }}
- name: Lint pull request title
uses: jef/conventional-commits-pr-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Remove label
run: gh pr edit --remove-label ${{ env.PR_LABEL }}
- name: Add label
if: ${{ failure() }}
run: gh pr edit --add-label ${{ env.PR_LABEL }}