-
Notifications
You must be signed in to change notification settings - Fork 156
63 lines (59 loc) · 2.33 KB
/
pr_title.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
name: PR Title Check
on:
pull_request_target:
types: [opened, edited, synchronize, reopened]
jobs:
commitlint:
name: PR title / description conforms to semantic-release
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install @commitlint/config-conventional
- run: >
echo 'module.exports = {
// Workaround for https://github.com/dependabot/dependabot-core/issues/5923
"ignores": [(message) => /^Bumps \[.+]\(.+\) from .+ to .+\.$/m.test(message)],
"rules": {
"body-max-line-length": [0, "always", Infinity],
"footer-max-line-length": [0, "always", Infinity],
"body-leading-blank": [0, "always"]
}
}' > .commitlintrc.js
- run: npx commitlint --extends @commitlint/config-conventional --verbose <<< $COMMIT_MSG
env:
COMMIT_MSG: >
${{ github.event.pull_request.title }}
${{ github.event.pull_request.body }}
- if: failure()
uses: actions/github-script@v7
with:
script: |
const message = `**ACTION NEEDED**
Substrait follows the [Conventional Commits
specification](https://www.conventionalcommits.org/en/v1.0.0/) for
release automation.
The PR title and description are used as the merge commit message.\
Please update your PR title and description to match the specification.
`
// Get list of current comments
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number
});
// Check if this job already commented
for (const comment of comments) {
if (comment.body === message) {
return // Already commented
}
}
// Post the comment about Conventional Commits
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: message
})
core.setFailed(message)