Skip to content

Commit e187277

Browse files
authored
fix: fail missing scope (#251)
1 parent c3bd8ee commit e187277

13 files changed

+64
-64
lines changed

Diff for: .github/dependabot.yaml

-10
This file was deleted.

Diff for: .github/hooks/pre-commit

-3
This file was deleted.

Diff for: .github/workflows/ci.yaml

+7-18
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,18 @@ on:
33
pull_request:
44
branches:
55
- main
6-
push:
7-
branches:
8-
- main
96
jobs:
10-
build-lint:
11-
name: Build and lint
7+
build_test_lint:
8+
name: Build, test, and lint
129
runs-on: ubuntu-latest
1310
steps:
1411
- name: Checkout repository
15-
uses: actions/checkout@v3
12+
uses: actions/checkout@v4
1613
- name: Setup Node.js
17-
uses: actions/setup-node@v3
18-
with:
19-
node-version: "16"
20-
- name: Setup build cache
21-
uses: actions/cache@v3
14+
uses: actions/setup-node@v4
2215
with:
23-
path: '**/node_modules'
24-
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
25-
restore-keys: ${{ runner.os }}-node-
16+
node-version-file: package.json
2617
- name: Install dependencies
2718
run: npm ci
28-
- name: Compile TypeScript
29-
run: npm run compile
30-
- name: Run linter
31-
run: npm run lint
19+
- name: Test
20+
run: npm run test

Diff for: .github/workflows/pr-lint.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
1-
name: Pull Request Linter
1+
name: Pull Request Title Linter
22
on:
33
pull_request:
44
types:
55
- opened
66
- edited
77
- reopened
8+
- synchronize
89
jobs:
9-
lint-pr:
10+
pr_lint:
1011
name: Lint pull request title
1112
runs-on: ubuntu-latest
1213
steps:
1314
- name: Checkout repository
14-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1516
- name: Lint pull request title
1617
uses: ./
1718
with:

Diff for: .github/workflows/release.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
branches:
55
- main
66
jobs:
7-
build-tag-release:
7+
build_tag_release:
88
name: Build, tag, and release
99
runs-on: ubuntu-latest
1010
steps:

Diff for: README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,16 @@ Live examples:
1414
## Usage
1515

1616
```yaml
17-
name: Pull Request Linter
17+
name: Pull Request Title Linter
1818
on:
1919
pull_request:
2020
types:
2121
- opened
2222
- edited
2323
- reopened
24+
- synchronize
2425
jobs:
25-
lint-pr:
26+
pr_lint:
2627
name: Lint pull request title
2728
runs-on: ubuntu-latest
2829
permissions:
@@ -32,6 +33,7 @@ jobs:
3233
uses: jef/conventional-commits-pr-action@v1
3334
with:
3435
token: ${{ secrets.GITHUB_TOKEN }}
36+
3537
```
3638

3739
## Inputs

Diff for: dist/index.js

+18-2
Original file line numberDiff line numberDiff line change
@@ -15741,6 +15741,14 @@ const { isUint8Array, isArrayBuffer } = __nccwpck_require__(8253)
1574115741
const { File: UndiciFile } = __nccwpck_require__(3041)
1574215742
const { parseMIMEType, serializeAMimeType } = __nccwpck_require__(4322)
1574315743

15744+
let random
15745+
try {
15746+
const crypto = __nccwpck_require__(7598)
15747+
random = (max) => crypto.randomInt(0, max)
15748+
} catch {
15749+
random = (max) => Math.floor(Math.random(max))
15750+
}
15751+
1574415752
let ReadableStream = globalThis.ReadableStream
1574515753

1574615754
/** @type {globalThis['File']} */
@@ -15826,7 +15834,7 @@ function extractBody (object, keepalive = false) {
1582615834
// Set source to a copy of the bytes held by object.
1582715835
source = new Uint8Array(object.buffer.slice(object.byteOffset, object.byteOffset + object.byteLength))
1582815836
} else if (util.isFormDataLike(object)) {
15829-
const boundary = `----formdata-undici-0${`${Math.floor(Math.random() * 1e11)}`.padStart(11, '0')}`
15837+
const boundary = `----formdata-undici-0${`${random(1e11)}`.padStart(11, '0')}`
1583015838
const prefix = `--${boundary}\r\nContent-Disposition: form-data`
1583115839

1583215840
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
@@ -30034,7 +30042,7 @@ function getConventionalCommitTypes() {
3003430042
}
3003530043
async function lintPullRequest(title) {
3003630044
const matches = types.map(type => {
30037-
return new RegExp(`^${type}(\\(.*\\))?!?:.*$`);
30045+
return new RegExp(`^${type}(\\(.+\\))?!?:.+$`);
3003830046
});
3003930047
return matches.some(regex => regex.test(title));
3004030048
}
@@ -30163,6 +30171,14 @@ module.exports = require("net");
3016330171

3016430172
/***/ }),
3016530173

30174+
/***/ 7598:
30175+
/***/ ((module) => {
30176+
30177+
"use strict";
30178+
module.exports = require("node:crypto");
30179+
30180+
/***/ }),
30181+
3016630182
/***/ 8474:
3016730183
/***/ ((module) => {
3016830184

Diff for: dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: jest.config.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
/** @type {import('ts-jest').JestConfigWithTsJest} **/
1+
/** @type {import("ts-jest").JestConfigWithTsJest} **/
22
module.exports = {
33
collectCoverage: true,
44
testEnvironment: 'node',
55
transform: {
66
'^.+.tsx?$': ['ts-jest', {}],
77
},
8+
testPathIgnorePatterns: ['<rootDir>/dist/'],
89
};

Diff for: package-lock.json

+17-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"clean": "gts clean",
1111
"fix": "gts fix",
1212
"lint": "gts lint",
13-
"start": "node --experimental-loader=node:ts ./src/main.js",
13+
"start": "node --experimental-loader=node:ts ./src/main.ts",
1414
"test": "jest",
1515
"posttest": "npm run lint"
1616
},
@@ -28,15 +28,15 @@
2828
},
2929
"devDependencies": {
3030
"@types/jest": "^29.5.14",
31-
"@types/node": "^22.10.2",
31+
"@types/node": "^22.13.1",
3232
"@vercel/ncc": "^0.38.3",
3333
"gts": "^6.0.2",
3434
"jest": "^29.7.0",
35-
"prettier": "^3.4.2",
35+
"prettier": "^3.5.0",
3636
"ts-jest": "^29.2.5",
37-
"typescript": "^5.7.2"
37+
"typescript": "^5.7.3"
3838
},
3939
"volta": {
40-
"node": "20.18.1"
40+
"node": "20.18.3"
4141
}
4242
}

Diff for: src/__tests__/lint.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ describe('lintPullRequest tests', () => {
3434
{args: 'feats: test', expected: false},
3535
{args: '(feat): test', expected: false},
3636
{args: 'test', expected: false},
37+
{args: 'feat(): test', expected: false},
38+
{args: 'feat:', expected: false},
39+
{args: 'feat():', expected: false},
40+
{args: 'feat(test):', expected: false},
3741
];
3842

3943
tests.forEach(({args, expected}) => {

Diff for: src/lint.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function getConventionalCommitTypes(): string {
2727

2828
export async function lintPullRequest(title: string) {
2929
const matches = types.map(type => {
30-
return new RegExp(`^${type}(\\(.*\\))?!?:.*$`);
30+
return new RegExp(`^${type}(\\(.+\\))?!?:.+$`);
3131
});
3232

3333
return matches.some(regex => regex.test(title));

0 commit comments

Comments
 (0)