-
Notifications
You must be signed in to change notification settings - Fork 15
119 lines (104 loc) · 3.55 KB
/
pr_evaluation.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
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: PR Evaluation
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, edited]
branches: ['main']
jobs:
debug:
name: Debug
runs-on: ubuntu-latest
steps:
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github.event.changes) }}
run: echo "$GITHUB_CONTEXT"
- name: Dump GitHub context (is title)
env:
IS_TITLE: ${{ github.event.changes.title }}
run: echo "$IS_TITLE"
semantic_pr:
name: Semantic PR title
runs-on: ubuntu-latest
if: ${{ github.event.action != 'edited' || github.event.changes.title != null }}
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Configure which types are allowed (newline-delimited).
# Default: https://github.com/commitizen/conventional-commit-types
types: |
fix
feat
docs
style
refactor
perf
test
build
ci
chore
revert
# Configure that a scope must always be provided.
requireScope: true
# Configure additional validation for the subject based on a regex.
# This example ensures the subject doesn't start with an uppercase character & has more than 50 chars.
subjectPattern: ^(?![A-Z])(?=.{1,50}$).+$
# If `subjectPattern` is configured, you can use this property to override
# the default error message that is shown when the pattern doesn't match.
# The variables `subject` and `title` can be used within the message.
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character & not have more than 50 characters.
detect-unresolved-conflicts:
name: Detect unresolved merge conflicts
runs-on: ubuntu-latest
needs: semantic_pr
steps:
- uses: actions/checkout@v3
- name: List files with merge conflict markers
run: git --no-pager grep "<<<<<<<" ":(exclude).github/" || true
- name: Fail or succeed job if any files with merge conflict markers have been checked in
# Find lines containing "<<<<<<<", then count the number of lines.
# 0 matching lines results in exit code 0, i.e. success.
run: exit $(git grep "<<<<<<<" ":(exclude).github/" | wc --lines)
linters:
name: Linting checks
runs-on: ubuntu-latest
needs: semantic_pr
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Run linters
run: npm run lint
tests:
name: Test checks
runs-on: ubuntu-latest
needs: semantic_pr
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm run test