forked from element-plus/element-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (58 loc) · 2.14 KB
/
lint-commit-message.yml
File metadata and controls
73 lines (58 loc) · 2.14 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Lint Commit Message
on:
pull_request:
types: [opened, edited, reopened]
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
# if pull request title is D2M, then skip this job
if: ${{ !contains(github.event.pull_request.title, 'D2M') }}
continue-on-error: true
outputs:
failed: ${{ steps.lint_commit.outputs.failed == 'true' }}
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}
PULL_REQUEST_AUTHOR: ${{ github.event.pull_request.user.login }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: Setup pnpm
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
- name: Setup node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24
cache: 'pnpm'
- name: Install dependencies
run: pnpm i --frozen-lockfile
- name: Lint commit
id: lint_commit
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
printf '%s\n' "$PR_TITLE" | pnpm run lint:commit || echo "failed=true" >> "$GITHUB_OUTPUT"
- name: Set success result
if: ${{ steps.lint_commit.outputs.failed != 'true' }}
run: echo 'true' > ./lint-result.txt
- name: Set failed result
if: ${{ steps.lint_commit.outputs.failed == 'true' }}
run: echo 'false' > ./lint-result.txt
- name: Set PR number
run: echo "$PULL_REQUEST_NUMBER" > ./pr.txt
- name: Set PR author
run: echo "$PULL_REQUEST_AUTHOR" > ./author.txt
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: commit-lint-result
path: ./lint-result.txt
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pr-number
path: ./pr.txt
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pr-author
path: ./author.txt