Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
2226d7cb06 | |||
8d744d5b7f | |||
0e58f8e7ab | |||
6a3fb764d5 | |||
696fa5c0e7 | |||
80284ede25 | |||
818ec4d51a | |||
1c50240be2 |
2
.github/workflows/codeql.yaml
vendored
2
.github/workflows/codeql.yaml
vendored
@ -3,12 +3,10 @@ name: "Code Scanning - Action"
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches:
|
branches:
|
||||||
- master
|
|
||||||
- main
|
- main
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 17 * * 5'
|
- cron: '0 17 * * 5'
|
||||||
|
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@ -2,13 +2,10 @@ name: "build-and-test"
|
|||||||
on: # rebuild any PRs and main branch changes
|
on: # rebuild any PRs and main branch changes
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
|
||||||
- main
|
- main
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
|
||||||
- main
|
- main
|
||||||
- "releases/*"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build: # make sure build/ci work properly
|
build: # make sure build/ci work properly
|
||||||
@ -51,7 +48,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- ubuntu-24.04-arm
|
- ubuntu-22.04-arm
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
version:
|
version:
|
||||||
@ -73,7 +70,6 @@ jobs:
|
|||||||
version: ${{ matrix.version }}
|
version: ${{ matrix.version }}
|
||||||
args: --timeout=5m --issues-exit-code=0 ./sample/...
|
args: --timeout=5m --issues-exit-code=0 ./sample/...
|
||||||
only-new-issues: true
|
only-new-issues: true
|
||||||
verify: true
|
|
||||||
|
|
||||||
test-go-install: # make sure the action works on a clean machine without building (go-install mode)
|
test-go-install: # make sure the action works on a clean machine without building (go-install mode)
|
||||||
needs: [ build ]
|
needs: [ build ]
|
||||||
@ -81,7 +77,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- ubuntu-24.04-arm
|
- ubuntu-22.04-arm
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
version:
|
version:
|
||||||
@ -104,7 +100,6 @@ jobs:
|
|||||||
args: --timeout=5m --issues-exit-code=0 ./sample/...
|
args: --timeout=5m --issues-exit-code=0 ./sample/...
|
||||||
only-new-issues: true
|
only-new-issues: true
|
||||||
install-mode: goinstall
|
install-mode: goinstall
|
||||||
verify: true
|
|
||||||
|
|
||||||
test-go-mod:
|
test-go-mod:
|
||||||
needs: [ build ]
|
needs: [ build ]
|
||||||
@ -112,7 +107,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os:
|
os:
|
||||||
- ubuntu-latest
|
- ubuntu-latest
|
||||||
- ubuntu-24.04-arm
|
- ubuntu-22.04-arm
|
||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
wd:
|
wd:
|
||||||
@ -130,4 +125,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
working-directory: ${{ matrix.wd }}
|
working-directory: ${{ matrix.wd }}
|
||||||
args: --timeout=5m --issues-exit-code=0 ./...
|
args: --timeout=5m --issues-exit-code=0 ./...
|
||||||
verify: true
|
|
||||||
|
@ -24,7 +24,7 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
verify:
|
verify:
|
||||||
description: "if set to true and the action verify the configuration file against the JSONSchema"
|
description: "if set to true and the action verify the configuration file against the JSONSchema"
|
||||||
default: 'false'
|
default: 'true'
|
||||||
required: false
|
required: false
|
||||||
only-new-issues:
|
only-new-issues:
|
||||||
description: "if set to true and the action runs on a pull request - the action outputs only newly found issues"
|
description: "if set to true and the action runs on a pull request - the action outputs only newly found issues"
|
||||||
|
48
dist/post_run/index.js
generated
vendored
48
dist/post_run/index.js
generated
vendored
@ -42098,7 +42098,7 @@ module.exports = __toCommonJS(dist_src_exports);
|
|||||||
var import_universal_user_agent = __nccwpck_require__(3843);
|
var import_universal_user_agent = __nccwpck_require__(3843);
|
||||||
|
|
||||||
// pkg/dist-src/version.js
|
// pkg/dist-src/version.js
|
||||||
var VERSION = "9.0.5";
|
var VERSION = "9.0.6";
|
||||||
|
|
||||||
// pkg/dist-src/defaults.js
|
// pkg/dist-src/defaults.js
|
||||||
var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
|
var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
|
||||||
@ -42203,9 +42203,9 @@ function addQueryParameters(url, parameters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pkg/dist-src/util/extract-url-variable-names.js
|
// pkg/dist-src/util/extract-url-variable-names.js
|
||||||
var urlVariableRegex = /\{[^}]+\}/g;
|
var urlVariableRegex = /\{[^{}}]+\}/g;
|
||||||
function removeNonChars(variableName) {
|
function removeNonChars(variableName) {
|
||||||
return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
|
return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
|
||||||
}
|
}
|
||||||
function extractUrlVariableNames(url) {
|
function extractUrlVariableNames(url) {
|
||||||
const matches = url.match(urlVariableRegex);
|
const matches = url.match(urlVariableRegex);
|
||||||
@ -42391,7 +42391,7 @@ function parse(options) {
|
|||||||
}
|
}
|
||||||
if (url.endsWith("/graphql")) {
|
if (url.endsWith("/graphql")) {
|
||||||
if (options.mediaType.previews?.length) {
|
if (options.mediaType.previews?.length) {
|
||||||
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
|
const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
|
||||||
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
|
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
|
||||||
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
|
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
|
||||||
return `application/vnd.github.${preview}-preview${format}`;
|
return `application/vnd.github.${preview}-preview${format}`;
|
||||||
@ -45240,7 +45240,7 @@ var RequestError = class extends Error {
|
|||||||
if (options.request.headers.authorization) {
|
if (options.request.headers.authorization) {
|
||||||
requestCopy.headers = Object.assign({}, options.request.headers, {
|
requestCopy.headers = Object.assign({}, options.request.headers, {
|
||||||
authorization: options.request.headers.authorization.replace(
|
authorization: options.request.headers.authorization.replace(
|
||||||
/ .*$/,
|
/(?<! ) .*$/,
|
||||||
" [REDACTED]"
|
" [REDACTED]"
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
@ -94123,12 +94123,7 @@ async function runLint(binPath, patchPath) {
|
|||||||
}
|
}
|
||||||
cmdArgs.cwd = path.resolve(workingDirectory);
|
cmdArgs.cwd = path.resolve(workingDirectory);
|
||||||
}
|
}
|
||||||
if (core.getBooleanInput(`verify`, { required: true })) {
|
await runVerify(binPath, userArgsMap, cmdArgs);
|
||||||
const cmdVerify = `${binPath} config verify`;
|
|
||||||
core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
|
||||||
const res = await execShellCommand(cmdVerify, cmdArgs);
|
|
||||||
printOutput(res);
|
|
||||||
}
|
|
||||||
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd();
|
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd();
|
||||||
core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
@ -94150,6 +94145,37 @@ async function runLint(binPath, patchPath) {
|
|||||||
}
|
}
|
||||||
core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`);
|
core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`);
|
||||||
}
|
}
|
||||||
|
async function runVerify(binPath, userArgsMap, cmdArgs) {
|
||||||
|
const verify = core.getBooleanInput(`verify`, { required: true });
|
||||||
|
if (!verify) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cfgPath = await getConfigPath(binPath, userArgsMap, cmdArgs);
|
||||||
|
if (!cfgPath) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let cmdVerify = `${binPath} config verify`;
|
||||||
|
if (userArgsMap.get("config")) {
|
||||||
|
cmdVerify += ` --config=${userArgsMap.get("config")}`;
|
||||||
|
}
|
||||||
|
core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
||||||
|
const res = await execShellCommand(cmdVerify, cmdArgs);
|
||||||
|
printOutput(res);
|
||||||
|
}
|
||||||
|
async function getConfigPath(binPath, userArgsMap, cmdArgs) {
|
||||||
|
let cmdConfigPath = `${binPath} config path`;
|
||||||
|
if (userArgsMap.get("config")) {
|
||||||
|
cmdConfigPath += ` --config=${userArgsMap.get("config")}`;
|
||||||
|
}
|
||||||
|
core.info(`Running [${cmdConfigPath}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
||||||
|
try {
|
||||||
|
const resPath = await execShellCommand(cmdConfigPath, cmdArgs);
|
||||||
|
return resPath.stderr.trim();
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv);
|
const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv);
|
||||||
|
48
dist/run/index.js
generated
vendored
48
dist/run/index.js
generated
vendored
@ -42098,7 +42098,7 @@ module.exports = __toCommonJS(dist_src_exports);
|
|||||||
var import_universal_user_agent = __nccwpck_require__(3843);
|
var import_universal_user_agent = __nccwpck_require__(3843);
|
||||||
|
|
||||||
// pkg/dist-src/version.js
|
// pkg/dist-src/version.js
|
||||||
var VERSION = "9.0.5";
|
var VERSION = "9.0.6";
|
||||||
|
|
||||||
// pkg/dist-src/defaults.js
|
// pkg/dist-src/defaults.js
|
||||||
var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
|
var userAgent = `octokit-endpoint.js/${VERSION} ${(0, import_universal_user_agent.getUserAgent)()}`;
|
||||||
@ -42203,9 +42203,9 @@ function addQueryParameters(url, parameters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pkg/dist-src/util/extract-url-variable-names.js
|
// pkg/dist-src/util/extract-url-variable-names.js
|
||||||
var urlVariableRegex = /\{[^}]+\}/g;
|
var urlVariableRegex = /\{[^{}}]+\}/g;
|
||||||
function removeNonChars(variableName) {
|
function removeNonChars(variableName) {
|
||||||
return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
|
return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/);
|
||||||
}
|
}
|
||||||
function extractUrlVariableNames(url) {
|
function extractUrlVariableNames(url) {
|
||||||
const matches = url.match(urlVariableRegex);
|
const matches = url.match(urlVariableRegex);
|
||||||
@ -42391,7 +42391,7 @@ function parse(options) {
|
|||||||
}
|
}
|
||||||
if (url.endsWith("/graphql")) {
|
if (url.endsWith("/graphql")) {
|
||||||
if (options.mediaType.previews?.length) {
|
if (options.mediaType.previews?.length) {
|
||||||
const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
|
const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || [];
|
||||||
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
|
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
|
||||||
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
|
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
|
||||||
return `application/vnd.github.${preview}-preview${format}`;
|
return `application/vnd.github.${preview}-preview${format}`;
|
||||||
@ -45240,7 +45240,7 @@ var RequestError = class extends Error {
|
|||||||
if (options.request.headers.authorization) {
|
if (options.request.headers.authorization) {
|
||||||
requestCopy.headers = Object.assign({}, options.request.headers, {
|
requestCopy.headers = Object.assign({}, options.request.headers, {
|
||||||
authorization: options.request.headers.authorization.replace(
|
authorization: options.request.headers.authorization.replace(
|
||||||
/ .*$/,
|
/(?<! ) .*$/,
|
||||||
" [REDACTED]"
|
" [REDACTED]"
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
@ -94123,12 +94123,7 @@ async function runLint(binPath, patchPath) {
|
|||||||
}
|
}
|
||||||
cmdArgs.cwd = path.resolve(workingDirectory);
|
cmdArgs.cwd = path.resolve(workingDirectory);
|
||||||
}
|
}
|
||||||
if (core.getBooleanInput(`verify`, { required: true })) {
|
await runVerify(binPath, userArgsMap, cmdArgs);
|
||||||
const cmdVerify = `${binPath} config verify`;
|
|
||||||
core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
|
||||||
const res = await execShellCommand(cmdVerify, cmdArgs);
|
|
||||||
printOutput(res);
|
|
||||||
}
|
|
||||||
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd();
|
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd();
|
||||||
core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
core.info(`Running [${cmd}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
@ -94150,6 +94145,37 @@ async function runLint(binPath, patchPath) {
|
|||||||
}
|
}
|
||||||
core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`);
|
core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`);
|
||||||
}
|
}
|
||||||
|
async function runVerify(binPath, userArgsMap, cmdArgs) {
|
||||||
|
const verify = core.getBooleanInput(`verify`, { required: true });
|
||||||
|
if (!verify) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cfgPath = await getConfigPath(binPath, userArgsMap, cmdArgs);
|
||||||
|
if (!cfgPath) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let cmdVerify = `${binPath} config verify`;
|
||||||
|
if (userArgsMap.get("config")) {
|
||||||
|
cmdVerify += ` --config=${userArgsMap.get("config")}`;
|
||||||
|
}
|
||||||
|
core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
||||||
|
const res = await execShellCommand(cmdVerify, cmdArgs);
|
||||||
|
printOutput(res);
|
||||||
|
}
|
||||||
|
async function getConfigPath(binPath, userArgsMap, cmdArgs) {
|
||||||
|
let cmdConfigPath = `${binPath} config path`;
|
||||||
|
if (userArgsMap.get("config")) {
|
||||||
|
cmdConfigPath += ` --config=${userArgsMap.get("config")}`;
|
||||||
|
}
|
||||||
|
core.info(`Running [${cmdConfigPath}] in [${cmdArgs.cwd || process.cwd()}] ...`);
|
||||||
|
try {
|
||||||
|
const resPath = await execShellCommand(cmdConfigPath, cmdArgs);
|
||||||
|
return resPath.stderr.trim();
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
return ``;
|
||||||
|
}
|
||||||
|
}
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv);
|
const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv);
|
||||||
|
18
package-lock.json
generated
18
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "golanci-lint-action",
|
"name": "golanci-lint-action",
|
||||||
"version": "6.4.0",
|
"version": "6.5.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "golanci-lint-action",
|
"name": "golanci-lint-action",
|
||||||
"version": "6.4.0",
|
"version": "6.5.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^4.0.0",
|
"@actions/cache": "^4.0.0",
|
||||||
@ -485,9 +485,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/endpoint": {
|
"node_modules/@octokit/endpoint": {
|
||||||
"version": "9.0.5",
|
"version": "9.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz",
|
||||||
"integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==",
|
"integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/types": "^13.1.0",
|
"@octokit/types": "^13.1.0",
|
||||||
"universal-user-agent": "^6.0.0"
|
"universal-user-agent": "^6.0.0"
|
||||||
@ -583,9 +584,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@octokit/request-error": {
|
"node_modules/@octokit/request-error": {
|
||||||
"version": "5.1.0",
|
"version": "5.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
|
||||||
"integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==",
|
"integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@octokit/types": "^13.1.0",
|
"@octokit/types": "^13.1.0",
|
||||||
"deprecation": "^2.0.0",
|
"deprecation": "^2.0.0",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "golanci-lint-action",
|
"name": "golanci-lint-action",
|
||||||
"version": "6.4.0",
|
"version": "6.5.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "golangci-lint github action",
|
"description": "golangci-lint github action",
|
||||||
"main": "dist/main.js",
|
"main": "dist/main.js",
|
||||||
|
47
src/run.ts
47
src/run.ts
@ -137,14 +137,7 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
|
|||||||
cmdArgs.cwd = path.resolve(workingDirectory)
|
cmdArgs.cwd = path.resolve(workingDirectory)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core.getBooleanInput(`verify`, { required: true })) {
|
await runVerify(binPath, userArgsMap, cmdArgs)
|
||||||
const cmdVerify = `${binPath} config verify`
|
|
||||||
|
|
||||||
core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`)
|
|
||||||
|
|
||||||
const res = await execShellCommand(cmdVerify, cmdArgs)
|
|
||||||
printOutput(res)
|
|
||||||
}
|
|
||||||
|
|
||||||
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd()
|
const cmd = `${binPath} run ${addedArgs.join(` `)} ${userArgs}`.trimEnd()
|
||||||
|
|
||||||
@ -170,6 +163,44 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
|
|||||||
core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`)
|
core.info(`Ran golangci-lint in ${Date.now() - startedAt}ms`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function runVerify(binPath: string, userArgsMap: Map<string, string>, cmdArgs: ExecOptions): Promise<void> {
|
||||||
|
const verify = core.getBooleanInput(`verify`, { required: true })
|
||||||
|
if (!verify) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const cfgPath = await getConfigPath(binPath, userArgsMap, cmdArgs)
|
||||||
|
if (!cfgPath) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
let cmdVerify = `${binPath} config verify`
|
||||||
|
if (userArgsMap.get("config")) {
|
||||||
|
cmdVerify += ` --config=${userArgsMap.get("config")}`
|
||||||
|
}
|
||||||
|
|
||||||
|
core.info(`Running [${cmdVerify}] in [${cmdArgs.cwd || process.cwd()}] ...`)
|
||||||
|
|
||||||
|
const res = await execShellCommand(cmdVerify, cmdArgs)
|
||||||
|
printOutput(res)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getConfigPath(binPath: string, userArgsMap: Map<string, string>, cmdArgs: ExecOptions): Promise<string> {
|
||||||
|
let cmdConfigPath = `${binPath} config path`
|
||||||
|
if (userArgsMap.get("config")) {
|
||||||
|
cmdConfigPath += ` --config=${userArgsMap.get("config")}`
|
||||||
|
}
|
||||||
|
|
||||||
|
core.info(`Running [${cmdConfigPath}] in [${cmdArgs.cwd || process.cwd()}] ...`)
|
||||||
|
|
||||||
|
try {
|
||||||
|
const resPath = await execShellCommand(cmdConfigPath, cmdArgs)
|
||||||
|
return resPath.stderr.trim()
|
||||||
|
} catch {
|
||||||
|
return ``
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv)
|
const { binPath, patchPath } = await core.group(`prepare environment`, prepareEnv)
|
||||||
|
Reference in New Issue
Block a user