Skip to content

Commit f81aa09

Browse files
authored
ci: check pr title with commitlint (#828)
* Add workflow to lint PR title on PRs * Install necessary packages for commitlint permanently * Trigger workflow only if the target branch is main * test * Revert "test" This reverts commit fb6e0e8.
1 parent 839cfea commit f81aa09

File tree

5 files changed

+2253
-18
lines changed

5 files changed

+2253
-18
lines changed

.github/workflows/opentelemetry.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- ci
88
- dist-tag
99
- e2e
10+
- pr-title-lint
1011
- release
1112
types: [completed]
1213

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: pr-title-lint
2+
3+
on:
4+
pull_request_target:
5+
branches:
6+
- main
7+
types:
8+
- opened
9+
- synchronize
10+
- edited
11+
12+
jobs:
13+
pr-title-lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-node@v3
18+
with:
19+
cache: npm
20+
node-version-file: .nvmrc
21+
- run: npm ci
22+
- name: Lint PR title
23+
run: echo "${PR_TITLE}" | npx commitlint
24+
env:
25+
PR_TITLE: ${{ github.event.pull_request.title }}

commitlint.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* MIT License
3+
*
4+
* Copyright (c) 2020-present, Elastic NV
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*
24+
*/
25+
26+
module.exports = { extends: ['@commitlint/config-conventional'] };

0 commit comments

Comments
 (0)