mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-02-25 09:01:49 +00:00
Add skip-go-installation to use pre-installed Go
Add the golangci-lint to PATH
This commit is contained in:
parent
302bfa5ff4
commit
7c6389e6e2
6 changed files with 27 additions and 3 deletions
|
|
@ -47,6 +47,9 @@ jobs:
|
||||||
|
|
||||||
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
# Optional: show only new issues if it's a pull request. The default value is `false`.
|
||||||
# only-new-issues: true
|
# only-new-issues: true
|
||||||
|
|
||||||
|
# Optional: if set to true then the action will use pre-installed Go
|
||||||
|
# skip-go-installation: true
|
||||||
```
|
```
|
||||||
|
|
||||||
We recommend running this action in a job separate from other jobs (`go test`, etc)
|
We recommend running this action in a job separate from other jobs (`go test`, etc)
|
||||||
|
|
@ -94,7 +97,7 @@ jobs:
|
||||||
You will also likely need to add the following `.gitattributes` file to ensure that line endings for windows builds are properly formatted:
|
You will also likely need to add the following `.gitattributes` file to ensure that line endings for windows builds are properly formatted:
|
||||||
|
|
||||||
```.gitattributes
|
```.gitattributes
|
||||||
*.go text eol=lf
|
*.go text eol=lf
|
||||||
```
|
```
|
||||||
|
|
||||||
## Comments and Annotations
|
## Comments and Annotations
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
---
|
|
||||||
name: "Run golangci-lint"
|
name: "Run golangci-lint"
|
||||||
description: "Official golangci-lint action with line-attached annotations for found issues, caching and parallel execution."
|
description: "Official golangci-lint action with line-attached annotations for found issues, caching and parallel execution."
|
||||||
author: "golangci"
|
author: "golangci"
|
||||||
|
|
@ -21,7 +20,10 @@ inputs:
|
||||||
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"
|
||||||
default: false
|
default: false
|
||||||
required: true
|
required: true
|
||||||
|
skip-go-installation:
|
||||||
|
description: "if set to true then action uses pre-installed Go"
|
||||||
|
default: false
|
||||||
|
required: true
|
||||||
runs:
|
runs:
|
||||||
using: "node12"
|
using: "node12"
|
||||||
main: "dist/run/index.js"
|
main: "dist/run/index.js"
|
||||||
|
|
|
||||||
6
dist/post_run/index.js
vendored
6
dist/post_run/index.js
vendored
|
|
@ -7169,6 +7169,7 @@ function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const { lintPath, patchPath } = yield core.group(`prepare environment`, prepareEnv);
|
const { lintPath, patchPath } = yield core.group(`prepare environment`, prepareEnv);
|
||||||
|
core.addPath(path.dirname(lintPath));
|
||||||
yield core.group(`run golangci-lint`, () => runLint(lintPath, patchPath));
|
yield core.group(`run golangci-lint`, () => runLint(lintPath, patchPath));
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
@ -48591,6 +48592,11 @@ function installLint(versionConfig) {
|
||||||
exports.installLint = installLint;
|
exports.installLint = installLint;
|
||||||
function installGo() {
|
function installGo() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const skipGoInstallation = core.getInput(`skip-go-installation`, { required: true }).trim();
|
||||||
|
if (skipGoInstallation.toLowerCase() == "true") {
|
||||||
|
core.info(`Skipping the installation of Go`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
process.env[`INPUT_GO-VERSION`] = `1`;
|
process.env[`INPUT_GO-VERSION`] = `1`;
|
||||||
yield main_1.run();
|
yield main_1.run();
|
||||||
|
|
|
||||||
6
dist/run/index.js
vendored
6
dist/run/index.js
vendored
|
|
@ -7179,6 +7179,7 @@ function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
const { lintPath, patchPath } = yield core.group(`prepare environment`, prepareEnv);
|
const { lintPath, patchPath } = yield core.group(`prepare environment`, prepareEnv);
|
||||||
|
core.addPath(path.dirname(lintPath));
|
||||||
yield core.group(`run golangci-lint`, () => runLint(lintPath, patchPath));
|
yield core.group(`run golangci-lint`, () => runLint(lintPath, patchPath));
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
@ -48601,6 +48602,11 @@ function installLint(versionConfig) {
|
||||||
exports.installLint = installLint;
|
exports.installLint = installLint;
|
||||||
function installGo() {
|
function installGo() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const skipGoInstallation = core.getInput(`skip-go-installation`, { required: true }).trim();
|
||||||
|
if (skipGoInstallation.toLowerCase() == "true") {
|
||||||
|
core.info(`Skipping the installation of Go`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const startedAt = Date.now();
|
const startedAt = Date.now();
|
||||||
process.env[`INPUT_GO-VERSION`] = `1`;
|
process.env[`INPUT_GO-VERSION`] = `1`;
|
||||||
yield main_1.run();
|
yield main_1.run();
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,12 @@ export async function installLint(versionConfig: VersionConfig): Promise<string>
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function installGo(): Promise<void> {
|
export async function installGo(): Promise<void> {
|
||||||
|
const skipGoInstallation = core.getInput(`skip-go-installation`, { required: true }).trim()
|
||||||
|
if (skipGoInstallation.toLowerCase() == "true") {
|
||||||
|
core.info(`Skipping the installation of Go`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const startedAt = Date.now()
|
const startedAt = Date.now()
|
||||||
process.env[`INPUT_GO-VERSION`] = `1`
|
process.env[`INPUT_GO-VERSION`] = `1`
|
||||||
await setupGo()
|
await setupGo()
|
||||||
|
|
|
||||||
|
|
@ -187,6 +187,7 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const { lintPath, patchPath } = await core.group(`prepare environment`, prepareEnv)
|
const { lintPath, patchPath } = await core.group(`prepare environment`, prepareEnv)
|
||||||
|
core.addPath(path.dirname(lintPath))
|
||||||
await core.group(`run golangci-lint`, () => runLint(lintPath, patchPath))
|
await core.group(`run golangci-lint`, () => runLint(lintPath, patchPath))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.error(`Failed to run: ${error}, ${error.stack}`)
|
core.error(`Failed to run: ${error}, ${error.stack}`)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue