mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-02-25 00:51:49 +00:00
parent
85a3a6abe4
commit
6c1477a5f7
4 changed files with 24 additions and 4 deletions
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
|
|
@ -23,4 +23,5 @@ jobs:
|
||||||
- uses: ./
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
version: v1.26
|
version: v1.26
|
||||||
args: --issues-exit-code=0 ./sample/...
|
args: --issues-exit-code=0 ./...
|
||||||
|
working-directory: sample
|
||||||
|
|
|
||||||
8
dist/post_run/index.js
vendored
8
dist/post_run/index.js
vendored
|
|
@ -2352,6 +2352,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const child_process_1 = __webpack_require__(129);
|
const child_process_1 = __webpack_require__(129);
|
||||||
|
const fs = __importStar(__webpack_require__(747));
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
const util_1 = __webpack_require__(669);
|
const util_1 = __webpack_require__(669);
|
||||||
const cache_1 = __webpack_require__(722);
|
const cache_1 = __webpack_require__(722);
|
||||||
const install_1 = __webpack_require__(655);
|
const install_1 = __webpack_require__(655);
|
||||||
|
|
@ -2396,11 +2398,15 @@ function runLint(lintPath) {
|
||||||
if (args.includes(`-out-format`)) {
|
if (args.includes(`-out-format`)) {
|
||||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
|
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
|
||||||
}
|
}
|
||||||
|
const workingDirectory = path.resolve(core.getInput(`working-directory`));
|
||||||
|
if (!fs.existsSync(workingDirectory) || !fs.lstatSync(workingDirectory).isDirectory()) {
|
||||||
|
throw new Error(`working-directory (${workingDirectory}) was not a path`);
|
||||||
|
}
|
||||||
const cmd = `${lintPath} run --out-format=github-actions ${args}`.trimRight();
|
const cmd = `${lintPath} run --out-format=github-actions ${args}`.trimRight();
|
||||||
core.info(`Running [${cmd}] ...`);
|
core.info(`Running [${cmd}] ...`);
|
||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
try {
|
try {
|
||||||
const res = yield execShellCommand(cmd);
|
const res = yield execShellCommand(cmd, { cwd: workingDirectory });
|
||||||
printOutput(res);
|
printOutput(res);
|
||||||
core.info(`golangci-lint found no issues`);
|
core.info(`golangci-lint found no issues`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
dist/run/index.js
vendored
8
dist/run/index.js
vendored
|
|
@ -2364,6 +2364,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const core = __importStar(__webpack_require__(470));
|
const core = __importStar(__webpack_require__(470));
|
||||||
const child_process_1 = __webpack_require__(129);
|
const child_process_1 = __webpack_require__(129);
|
||||||
|
const fs = __importStar(__webpack_require__(747));
|
||||||
|
const path = __importStar(__webpack_require__(622));
|
||||||
const util_1 = __webpack_require__(669);
|
const util_1 = __webpack_require__(669);
|
||||||
const cache_1 = __webpack_require__(722);
|
const cache_1 = __webpack_require__(722);
|
||||||
const install_1 = __webpack_require__(655);
|
const install_1 = __webpack_require__(655);
|
||||||
|
|
@ -2408,11 +2410,15 @@ function runLint(lintPath) {
|
||||||
if (args.includes(`-out-format`)) {
|
if (args.includes(`-out-format`)) {
|
||||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
|
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`);
|
||||||
}
|
}
|
||||||
|
const workingDirectory = path.resolve(core.getInput(`working-directory`));
|
||||||
|
if (!fs.existsSync(workingDirectory) || !fs.lstatSync(workingDirectory).isDirectory()) {
|
||||||
|
throw new Error(`working-directory (${workingDirectory}) was not a path`);
|
||||||
|
}
|
||||||
const cmd = `${lintPath} run --out-format=github-actions ${args}`.trimRight();
|
const cmd = `${lintPath} run --out-format=github-actions ${args}`.trimRight();
|
||||||
core.info(`Running [${cmd}] ...`);
|
core.info(`Running [${cmd}] ...`);
|
||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
try {
|
try {
|
||||||
const res = yield execShellCommand(cmd);
|
const res = yield execShellCommand(cmd, { cwd: workingDirectory });
|
||||||
printOutput(res);
|
printOutput(res);
|
||||||
core.info(`golangci-lint found no issues`);
|
core.info(`golangci-lint found no issues`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import * as core from "@actions/core"
|
import * as core from "@actions/core"
|
||||||
import { exec } from "child_process"
|
import { exec } from "child_process"
|
||||||
|
import * as fs from "fs"
|
||||||
|
import * as path from "path"
|
||||||
import { promisify } from "util"
|
import { promisify } from "util"
|
||||||
|
|
||||||
import { restoreCache, saveCache } from "./cache"
|
import { restoreCache, saveCache } from "./cache"
|
||||||
|
|
@ -55,11 +57,16 @@ async function runLint(lintPath: string): Promise<void> {
|
||||||
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
|
throw new Error(`please, don't change out-format for golangci-lint: it can be broken in a future`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const workingDirectory = path.resolve(core.getInput(`working-directory`))
|
||||||
|
if (!fs.existsSync(workingDirectory) || !fs.lstatSync(workingDirectory).isDirectory()) {
|
||||||
|
throw new Error(`working-directory (${workingDirectory}) was not a path`)
|
||||||
|
}
|
||||||
|
|
||||||
const cmd = `${lintPath} run --out-format=github-actions ${args}`.trimRight()
|
const cmd = `${lintPath} run --out-format=github-actions ${args}`.trimRight()
|
||||||
core.info(`Running [${cmd}] ...`)
|
core.info(`Running [${cmd}] ...`)
|
||||||
const startedAt = Date.now()
|
const startedAt = Date.now()
|
||||||
try {
|
try {
|
||||||
const res = await execShellCommand(cmd)
|
const res = await execShellCommand(cmd, { cwd: workingDirectory })
|
||||||
printOutput(res)
|
printOutput(res)
|
||||||
core.info(`golangci-lint found no issues`)
|
core.info(`golangci-lint found no issues`)
|
||||||
} catch (exc) {
|
} catch (exc) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue