Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
a4f60bb28d | |||
5815a4b917 | |||
23faadfdeb | |||
b556f25b3c | |||
789f114c52 | |||
d36b91c294 | |||
a9eb115348 | |||
bd4fa7c900 |
38
README.md
38
README.md
@ -8,8 +8,11 @@ The action runs [golangci-lint](https://github.com/golangci/golangci-lint) and r
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Compatibility
|
||||
|
||||
* `v6.0.0+` removes `annotations` option, removes the default output format (`github-actions`).
|
||||
* `v5.0.0+` removes `skip-pkg-cache` and `skip-build-cache` because the cache related to Go itself is already handled by `actions/setup-go`.
|
||||
* `v4.0.0+` requires an explicit `actions/setup-go` installation step before using this action: `uses: actions/setup-go@v5`.
|
||||
The `skip-go-installation` option has been removed.
|
||||
@ -45,7 +48,7 @@ jobs:
|
||||
with:
|
||||
go-version: '1.22'
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: latest
|
||||
```
|
||||
@ -87,7 +90,7 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: latest
|
||||
```
|
||||
@ -110,7 +113,7 @@ The version of golangci-lint to use.
|
||||
* When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: latest
|
||||
# ...
|
||||
@ -125,7 +128,7 @@ The mode to install golangci-lint: it can be `binary` or `goinstall`.
|
||||
The default value is `binary`.
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
install-mode: "goinstall"
|
||||
# ...
|
||||
@ -140,7 +143,7 @@ Show only new issues.
|
||||
The default value is `false`.
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
only-new-issues: true
|
||||
# ...
|
||||
@ -158,7 +161,7 @@ with:
|
||||
Working directory, useful for monorepos.
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
working-directory: somedir
|
||||
# ...
|
||||
@ -174,7 +177,7 @@ takes precedence over all other caching options.
|
||||
The default value is `false`.
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
skip-cache: true
|
||||
# ...
|
||||
@ -189,7 +192,7 @@ If set to `true`, caches will not be saved, but they may still be restored, requ
|
||||
The default value is `false`.
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
skip-save-cache: true
|
||||
# ...
|
||||
@ -204,7 +207,7 @@ Periodically invalidate the cache every `cache-invalidation-interval` days to en
|
||||
The default value is `7`.
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
cache-invalidation-interval: 15
|
||||
# ...
|
||||
@ -212,23 +215,24 @@ with:
|
||||
|
||||
If set the number is `<= 0`, the cache will be always invalidate (Not recommended).
|
||||
|
||||
### `annotations`
|
||||
### `problem-matchers`
|
||||
|
||||
(optional)
|
||||
|
||||
To enable/disable GitHub Action annotations.
|
||||
Force the usage of the embedded problem matchers.
|
||||
|
||||
If disabled (`false`), the output format(s) will follow the golangci-lint configuration file (or CLI flags from `args`)
|
||||
and use the same default as golangci-lint (i.e. `colored-line-number`).
|
||||
By default, the [problem matcher of Go (`actions/setup-go`)](https://github.com/actions/setup-go/blob/main/matchers.json) already handles the golangci-lint output (`colored-line-number`).
|
||||
|
||||
Works only with `colored-line-number` (the golangci-lint default).
|
||||
|
||||
https://golangci-lint.run/usage/configuration/#output-configuration
|
||||
|
||||
The default value is `true`.
|
||||
The default value is `false`.
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
annotations: false
|
||||
problem-matchers: true
|
||||
# ...
|
||||
```
|
||||
|
||||
@ -242,7 +246,7 @@ Note: By default, the `.golangci.yml` file should be at the root of the reposito
|
||||
The location of the configuration file can be changed by using `--config=`
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v5
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
|
||||
# ...
|
||||
|
@ -36,9 +36,9 @@ inputs:
|
||||
restore existing caches, subject to other options.
|
||||
default: 'false'
|
||||
required: false
|
||||
annotations:
|
||||
description: "To Enable/disable GitHub Action annotations"
|
||||
default: 'true'
|
||||
problem-matchers:
|
||||
description: "Force the usage of the embedded problem matchers"
|
||||
default: 'false'
|
||||
required: false
|
||||
args:
|
||||
description: "golangci-lint command line arguments"
|
||||
|
33
dist/post_run/index.js
generated
vendored
33
dist/post_run/index.js
generated
vendored
@ -89228,7 +89228,7 @@ async function fetchPushPatch(ctx) {
|
||||
const patchResp = await octokit.rest.repos.compareCommitsWithBasehead({
|
||||
owner: ctx.repo.owner,
|
||||
repo: ctx.repo.repo,
|
||||
basehead: `${ctx.payload.before}..${ctx.payload.after}`,
|
||||
basehead: `${ctx.payload.before}...${ctx.payload.after}`,
|
||||
mediaType: {
|
||||
format: `diff`,
|
||||
},
|
||||
@ -89290,18 +89290,27 @@ async function runLint(lintPath, patchPath) {
|
||||
.map(([key, value]) => [key.toLowerCase(), value ?? ""]);
|
||||
const userArgsMap = new Map(userArgsList);
|
||||
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
||||
const annotations = core.getBooleanInput(`annotations`);
|
||||
if (annotations) {
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",");
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||
const problemMatchers = core.getBooleanInput(`problem-matchers`);
|
||||
if (problemMatchers) {
|
||||
const matchersPath = path.join(__dirname, "../..", "problem-matchers.json");
|
||||
if (fs.existsSync(matchersPath)) {
|
||||
// Adds problem matchers.
|
||||
// https://github.com/actions/setup-go/blob/cdcb36043654635271a94b9a6d1392de5bb323a7/src/main.ts#L81-L83
|
||||
core.info(`##[add-matcher]${matchersPath}`);
|
||||
}
|
||||
}
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`)) // Removes `github-actions` format.
|
||||
.join(",");
|
||||
if (formats) {
|
||||
// Adds formats but without `github-actions` format.
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
}
|
||||
// Removes `--out-format` from the user flags because it's already inside `addedArgs`.
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||
if (isOnlyNewIssues()) {
|
||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||
|
33
dist/run/index.js
generated
vendored
33
dist/run/index.js
generated
vendored
@ -89228,7 +89228,7 @@ async function fetchPushPatch(ctx) {
|
||||
const patchResp = await octokit.rest.repos.compareCommitsWithBasehead({
|
||||
owner: ctx.repo.owner,
|
||||
repo: ctx.repo.repo,
|
||||
basehead: `${ctx.payload.before}..${ctx.payload.after}`,
|
||||
basehead: `${ctx.payload.before}...${ctx.payload.after}`,
|
||||
mediaType: {
|
||||
format: `diff`,
|
||||
},
|
||||
@ -89290,18 +89290,27 @@ async function runLint(lintPath, patchPath) {
|
||||
.map(([key, value]) => [key.toLowerCase(), value ?? ""]);
|
||||
const userArgsMap = new Map(userArgsList);
|
||||
const userArgNames = new Set(userArgsList.map(([key]) => key));
|
||||
const annotations = core.getBooleanInput(`annotations`);
|
||||
if (annotations) {
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",");
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||
const problemMatchers = core.getBooleanInput(`problem-matchers`);
|
||||
if (problemMatchers) {
|
||||
const matchersPath = path.join(__dirname, "../..", "problem-matchers.json");
|
||||
if (fs.existsSync(matchersPath)) {
|
||||
// Adds problem matchers.
|
||||
// https://github.com/actions/setup-go/blob/cdcb36043654635271a94b9a6d1392de5bb323a7/src/main.ts#L81-L83
|
||||
core.info(`##[add-matcher]${matchersPath}`);
|
||||
}
|
||||
}
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`)) // Removes `github-actions` format.
|
||||
.join(",");
|
||||
if (formats) {
|
||||
// Adds formats but without `github-actions` format.
|
||||
addedArgs.push(`--out-format=${formats}`);
|
||||
}
|
||||
// Removes `--out-format` from the user flags because it's already inside `addedArgs`.
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim();
|
||||
if (isOnlyNewIssues()) {
|
||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||
throw new Error(`please, don't specify manually --new* args when requesting only new issues`);
|
||||
|
186
package-lock.json
generated
186
package-lock.json
generated
@ -15,14 +15,14 @@
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/http-client": "^2.2.1",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@types/node": "^20.12.7",
|
||||
"@types/node": "^20.12.8",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/tmp": "^0.2.6",
|
||||
"tmp": "^0.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
||||
"@typescript-eslint/parser": "^7.7.1",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
@ -643,9 +643,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.12.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz",
|
||||
"integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==",
|
||||
"version": "20.12.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz",
|
||||
"integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==",
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
}
|
||||
@ -691,16 +691,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/eslint-plugin": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.7.1.tgz",
|
||||
"integrity": "sha512-KwfdWXJBOviaBVhxO3p5TJiLpNuh2iyXyjmWN0f1nU87pwyvfS0EmjC6ukQVYVFJd/K1+0NWGPDXiyEyQorn0Q==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.8.0.tgz",
|
||||
"integrity": "sha512-gFTT+ezJmkwutUPmB0skOj3GZJtlEGnlssems4AjkVweUPGj7jRwwqg0Hhg7++kPGJqKtTYx+R05Ftww372aIg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/regexpp": "^4.10.0",
|
||||
"@typescript-eslint/scope-manager": "7.7.1",
|
||||
"@typescript-eslint/type-utils": "7.7.1",
|
||||
"@typescript-eslint/utils": "7.7.1",
|
||||
"@typescript-eslint/visitor-keys": "7.7.1",
|
||||
"@typescript-eslint/scope-manager": "7.8.0",
|
||||
"@typescript-eslint/type-utils": "7.8.0",
|
||||
"@typescript-eslint/utils": "7.8.0",
|
||||
"@typescript-eslint/visitor-keys": "7.8.0",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.3.1",
|
||||
@ -741,15 +741,15 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/parser": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.7.1.tgz",
|
||||
"integrity": "sha512-vmPzBOOtz48F6JAGVS/kZYk4EkXao6iGrD838sp1w3NQQC0W8ry/q641KU4PrG7AKNAf56NOcR8GOpH8l9FPCw==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.8.0.tgz",
|
||||
"integrity": "sha512-KgKQly1pv0l4ltcftP59uQZCi4HUYswCLbTqVZEJu7uLX8CTLyswqMLqLN+2QFz4jCptqWVV4SB7vdxcH2+0kQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/scope-manager": "7.7.1",
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/typescript-estree": "7.7.1",
|
||||
"@typescript-eslint/visitor-keys": "7.7.1",
|
||||
"@typescript-eslint/scope-manager": "7.8.0",
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"@typescript-eslint/typescript-estree": "7.8.0",
|
||||
"@typescript-eslint/visitor-keys": "7.8.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
@ -769,13 +769,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/scope-manager": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.7.1.tgz",
|
||||
"integrity": "sha512-PytBif2SF+9SpEUKynYn5g1RHFddJUcyynGpztX3l/ik7KmZEv19WCMhUBkHXPU9es/VWGD3/zg3wg90+Dh2rA==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.8.0.tgz",
|
||||
"integrity": "sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/visitor-keys": "7.7.1"
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"@typescript-eslint/visitor-keys": "7.8.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || >=20.0.0"
|
||||
@ -786,13 +786,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/type-utils": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.7.1.tgz",
|
||||
"integrity": "sha512-ZksJLW3WF7o75zaBPScdW1Gbkwhd/lyeXGf1kQCxJaOeITscoSl0MjynVvCzuV5boUz/3fOI06Lz8La55mu29Q==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.8.0.tgz",
|
||||
"integrity": "sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/typescript-estree": "7.7.1",
|
||||
"@typescript-eslint/utils": "7.7.1",
|
||||
"@typescript-eslint/typescript-estree": "7.8.0",
|
||||
"@typescript-eslint/utils": "7.8.0",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.3.0"
|
||||
},
|
||||
@ -813,9 +813,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/types": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.7.1.tgz",
|
||||
"integrity": "sha512-AmPmnGW1ZLTpWa+/2omPrPfR7BcbUU4oha5VIbSbS1a1Tv966bklvLNXxp3mrbc+P2j4MNOTfDffNsk4o0c6/w==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.8.0.tgz",
|
||||
"integrity": "sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^18.18.0 || >=20.0.0"
|
||||
@ -826,13 +826,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/typescript-estree": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.7.1.tgz",
|
||||
"integrity": "sha512-CXe0JHCXru8Fa36dteXqmH2YxngKJjkQLjxzoj6LYwzZ7qZvgsLSc+eqItCrqIop8Vl2UKoAi0StVWu97FQZIQ==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.8.0.tgz",
|
||||
"integrity": "sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/visitor-keys": "7.7.1",
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"@typescript-eslint/visitor-keys": "7.8.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@ -893,17 +893,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/utils": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.7.1.tgz",
|
||||
"integrity": "sha512-QUvBxPEaBXf41ZBbaidKICgVL8Hin0p6prQDu6bbetWo39BKbWJxRsErOzMNT1rXvTll+J7ChrbmMCXM9rsvOQ==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.8.0.tgz",
|
||||
"integrity": "sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/scope-manager": "7.7.1",
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/typescript-estree": "7.7.1",
|
||||
"@typescript-eslint/scope-manager": "7.8.0",
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"@typescript-eslint/typescript-estree": "7.8.0",
|
||||
"semver": "^7.6.0"
|
||||
},
|
||||
"engines": {
|
||||
@ -933,12 +933,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@typescript-eslint/visitor-keys": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.7.1.tgz",
|
||||
"integrity": "sha512-gBL3Eq25uADw1LQ9kVpf3hRM+DWzs0uZknHYK3hq4jcTPqVCClHGDnB6UUUV2SFeBeA4KWHWbbLqmbGcZ4FYbw==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.8.0.tgz",
|
||||
"integrity": "sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"eslint-visitor-keys": "^3.4.3"
|
||||
},
|
||||
"engines": {
|
||||
@ -4563,9 +4563,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "20.12.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.7.tgz",
|
||||
"integrity": "sha512-wq0cICSkRLVaf3UGLMGItu/PtdY7oaXaI/RVU+xliKVOtRna3PRY57ZDfztpDL0n11vfymMUnXv8QwYCO7L1wg==",
|
||||
"version": "20.12.8",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.8.tgz",
|
||||
"integrity": "sha512-NU0rJLJnshZWdE/097cdCBbyW1h4hEg0xpovcoAQYHl8dnEyp/NAOiE45pvc+Bd1Dt+2r94v2eGFpQJ4R7g+2w==",
|
||||
"requires": {
|
||||
"undici-types": "~5.26.4"
|
||||
}
|
||||
@ -4610,16 +4610,16 @@
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/eslint-plugin": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.7.1.tgz",
|
||||
"integrity": "sha512-KwfdWXJBOviaBVhxO3p5TJiLpNuh2iyXyjmWN0f1nU87pwyvfS0EmjC6ukQVYVFJd/K1+0NWGPDXiyEyQorn0Q==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.8.0.tgz",
|
||||
"integrity": "sha512-gFTT+ezJmkwutUPmB0skOj3GZJtlEGnlssems4AjkVweUPGj7jRwwqg0Hhg7++kPGJqKtTYx+R05Ftww372aIg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@eslint-community/regexpp": "^4.10.0",
|
||||
"@typescript-eslint/scope-manager": "7.7.1",
|
||||
"@typescript-eslint/type-utils": "7.7.1",
|
||||
"@typescript-eslint/utils": "7.7.1",
|
||||
"@typescript-eslint/visitor-keys": "7.7.1",
|
||||
"@typescript-eslint/scope-manager": "7.8.0",
|
||||
"@typescript-eslint/type-utils": "7.8.0",
|
||||
"@typescript-eslint/utils": "7.8.0",
|
||||
"@typescript-eslint/visitor-keys": "7.8.0",
|
||||
"debug": "^4.3.4",
|
||||
"graphemer": "^1.4.0",
|
||||
"ignore": "^5.3.1",
|
||||
@ -4640,54 +4640,54 @@
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/parser": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.7.1.tgz",
|
||||
"integrity": "sha512-vmPzBOOtz48F6JAGVS/kZYk4EkXao6iGrD838sp1w3NQQC0W8ry/q641KU4PrG7AKNAf56NOcR8GOpH8l9FPCw==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.8.0.tgz",
|
||||
"integrity": "sha512-KgKQly1pv0l4ltcftP59uQZCi4HUYswCLbTqVZEJu7uLX8CTLyswqMLqLN+2QFz4jCptqWVV4SB7vdxcH2+0kQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/scope-manager": "7.7.1",
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/typescript-estree": "7.7.1",
|
||||
"@typescript-eslint/visitor-keys": "7.7.1",
|
||||
"@typescript-eslint/scope-manager": "7.8.0",
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"@typescript-eslint/typescript-estree": "7.8.0",
|
||||
"@typescript-eslint/visitor-keys": "7.8.0",
|
||||
"debug": "^4.3.4"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/scope-manager": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.7.1.tgz",
|
||||
"integrity": "sha512-PytBif2SF+9SpEUKynYn5g1RHFddJUcyynGpztX3l/ik7KmZEv19WCMhUBkHXPU9es/VWGD3/zg3wg90+Dh2rA==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.8.0.tgz",
|
||||
"integrity": "sha512-viEmZ1LmwsGcnr85gIq+FCYI7nO90DVbE37/ll51hjv9aG+YZMb4WDE2fyWpUR4O/UrhGRpYXK/XajcGTk2B8g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/visitor-keys": "7.7.1"
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"@typescript-eslint/visitor-keys": "7.8.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/type-utils": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.7.1.tgz",
|
||||
"integrity": "sha512-ZksJLW3WF7o75zaBPScdW1Gbkwhd/lyeXGf1kQCxJaOeITscoSl0MjynVvCzuV5boUz/3fOI06Lz8La55mu29Q==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.8.0.tgz",
|
||||
"integrity": "sha512-H70R3AefQDQpz9mGv13Uhi121FNMh+WEaRqcXTX09YEDky21km4dV1ZXJIp8QjXc4ZaVkXVdohvWDzbnbHDS+A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/typescript-estree": "7.7.1",
|
||||
"@typescript-eslint/utils": "7.7.1",
|
||||
"@typescript-eslint/typescript-estree": "7.8.0",
|
||||
"@typescript-eslint/utils": "7.8.0",
|
||||
"debug": "^4.3.4",
|
||||
"ts-api-utils": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/types": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.7.1.tgz",
|
||||
"integrity": "sha512-AmPmnGW1ZLTpWa+/2omPrPfR7BcbUU4oha5VIbSbS1a1Tv966bklvLNXxp3mrbc+P2j4MNOTfDffNsk4o0c6/w==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.8.0.tgz",
|
||||
"integrity": "sha512-wf0peJ+ZGlcH+2ZS23aJbOv+ztjeeP8uQ9GgwMJGVLx/Nj9CJt17GWgWWoSmoRVKAX2X+7fzEnAjxdvK2gqCLw==",
|
||||
"dev": true
|
||||
},
|
||||
"@typescript-eslint/typescript-estree": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.7.1.tgz",
|
||||
"integrity": "sha512-CXe0JHCXru8Fa36dteXqmH2YxngKJjkQLjxzoj6LYwzZ7qZvgsLSc+eqItCrqIop8Vl2UKoAi0StVWu97FQZIQ==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.8.0.tgz",
|
||||
"integrity": "sha512-5pfUCOwK5yjPaJQNy44prjCwtr981dO8Qo9J9PwYXZ0MosgAbfEMB008dJ5sNo3+/BN6ytBPuSvXUg9SAqB0dg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/visitor-keys": "7.7.1",
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"@typescript-eslint/visitor-keys": "7.8.0",
|
||||
"debug": "^4.3.4",
|
||||
"globby": "^11.1.0",
|
||||
"is-glob": "^4.0.3",
|
||||
@ -4726,17 +4726,17 @@
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/utils": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.7.1.tgz",
|
||||
"integrity": "sha512-QUvBxPEaBXf41ZBbaidKICgVL8Hin0p6prQDu6bbetWo39BKbWJxRsErOzMNT1rXvTll+J7ChrbmMCXM9rsvOQ==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.8.0.tgz",
|
||||
"integrity": "sha512-L0yFqOCflVqXxiZyXrDr80lnahQfSOfc9ELAAZ75sqicqp2i36kEZZGuUymHNFoYOqxRT05up760b4iGsl02nQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@eslint-community/eslint-utils": "^4.4.0",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@typescript-eslint/scope-manager": "7.7.1",
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/typescript-estree": "7.7.1",
|
||||
"@typescript-eslint/scope-manager": "7.8.0",
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"@typescript-eslint/typescript-estree": "7.8.0",
|
||||
"semver": "^7.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -4752,12 +4752,12 @@
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/visitor-keys": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.7.1.tgz",
|
||||
"integrity": "sha512-gBL3Eq25uADw1LQ9kVpf3hRM+DWzs0uZknHYK3hq4jcTPqVCClHGDnB6UUUV2SFeBeA4KWHWbbLqmbGcZ4FYbw==",
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.8.0.tgz",
|
||||
"integrity": "sha512-q4/gibTNBQNA0lGyYQCmWRS5D15n8rXh4QjK3KV+MBPlTYHpfBUT3D3PaPR/HeNiI9W6R7FvlkcGhNyAoP+caA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "7.7.1",
|
||||
"@typescript-eslint/types": "7.8.0",
|
||||
"eslint-visitor-keys": "^3.4.3"
|
||||
}
|
||||
},
|
||||
|
@ -30,14 +30,14 @@
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/http-client": "^2.2.1",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@types/node": "^20.12.7",
|
||||
"@types/node": "^20.12.8",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/tmp": "^0.2.6",
|
||||
"tmp": "^0.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^7.7.1",
|
||||
"@typescript-eslint/parser": "^7.7.1",
|
||||
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
||||
"@typescript-eslint/parser": "^7.8.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
|
17
problem-matchers.json
Normal file
17
problem-matchers.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"problemMatcher": [
|
||||
{
|
||||
"owner": "golangci-lint-colored-line-number",
|
||||
"severity": "error",
|
||||
"pattern": [
|
||||
{
|
||||
"regexp": "^([^:]+):(\\d+):(?:(\\d+):)?\\s+(.+ \\(.+\\))$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
37
src/run.ts
37
src/run.ts
@ -101,7 +101,7 @@ async function fetchPushPatch(ctx: Context): Promise<string> {
|
||||
const patchResp = await octokit.rest.repos.compareCommitsWithBasehead({
|
||||
owner: ctx.repo.owner,
|
||||
repo: ctx.repo.repo,
|
||||
basehead: `${ctx.payload.before}..${ctx.payload.after}`,
|
||||
basehead: `${ctx.payload.before}...${ctx.payload.after}`,
|
||||
mediaType: {
|
||||
format: `diff`,
|
||||
},
|
||||
@ -185,21 +185,32 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
||||
const userArgsMap = new Map<string, string>(userArgsList)
|
||||
const userArgNames = new Set<string>(userArgsList.map(([key]) => key))
|
||||
|
||||
const annotations = core.getBooleanInput(`annotations`)
|
||||
const problemMatchers = core.getBooleanInput(`problem-matchers`)
|
||||
|
||||
if (annotations) {
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`))
|
||||
.concat("github-actions")
|
||||
.join(",")
|
||||
|
||||
addedArgs.push(`--out-format=${formats}`)
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim()
|
||||
if (problemMatchers) {
|
||||
const matchersPath = path.join(__dirname, "../..", "problem-matchers.json")
|
||||
if (fs.existsSync(matchersPath)) {
|
||||
// Adds problem matchers.
|
||||
// https://github.com/actions/setup-go/blob/cdcb36043654635271a94b9a6d1392de5bb323a7/src/main.ts#L81-L83
|
||||
core.info(`##[add-matcher]${matchersPath}`)
|
||||
}
|
||||
}
|
||||
|
||||
const formats = (userArgsMap.get("out-format") || "")
|
||||
.trim()
|
||||
.split(",")
|
||||
.filter((f) => f.length > 0)
|
||||
.filter((f) => !f.startsWith(`github-actions`)) // Removes `github-actions` format.
|
||||
.join(",")
|
||||
|
||||
if (formats) {
|
||||
// Adds formats but without `github-actions` format.
|
||||
addedArgs.push(`--out-format=${formats}`)
|
||||
}
|
||||
|
||||
// Removes `--out-format` from the user flags because it's already inside `addedArgs`.
|
||||
userArgs = userArgs.replace(/--out-format=\S*/gi, "").trim()
|
||||
|
||||
if (isOnlyNewIssues()) {
|
||||
if (userArgNames.has(`new`) || userArgNames.has(`new-from-rev`) || userArgNames.has(`new-from-patch`)) {
|
||||
throw new Error(`please, don't specify manually --new* args when requesting only new issues`)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 145 KiB After Width: | Height: | Size: 90 KiB |
BIN
static/colored-line-number.png
Normal file
BIN
static/colored-line-number.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 70 KiB |
Reference in New Issue
Block a user