Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
e868220d9f | |||
0348c21999 | |||
a1c5369c06 | |||
90fbd40fc4 | |||
3d2a5790a3 |
44
.github/workflows/codeql.yaml
vendored
Normal file
44
.github/workflows/codeql.yaml
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
name: "Code Scanning - Action"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ master ]
|
||||
schedule:
|
||||
- cron: '0 17 * * 5'
|
||||
|
||||
jobs:
|
||||
codeQL:
|
||||
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
# Must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head of the pull request.
|
||||
# Only include this option if you are running this workflow on pull requests.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
# Only include this step if you are running this workflow on pull requests.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
with:
|
||||
language: 'javascript'
|
||||
|
||||
- run: |
|
||||
npm install
|
||||
npm run all
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
17
.github/workflows/test.yml
vendored
17
.github/workflows/test.yml
vendored
@ -29,3 +29,20 @@ jobs:
|
||||
version: latest
|
||||
args: --issues-exit-code=0 ./sample/...
|
||||
only-new-issues: true
|
||||
|
||||
# Test with full version vX.Y.Z
|
||||
test-full-version:
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu-latest
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: ./
|
||||
with:
|
||||
version: v1.28.3
|
||||
args: --issues-exit-code=0 ./sample/...
|
||||
only-new-issues: true
|
||||
|
@ -4,7 +4,7 @@ description: "Official golangci-lint action with line-attached annotations for f
|
||||
author: "golangci"
|
||||
inputs:
|
||||
version:
|
||||
description: "version of golangci-lint to use in form of v1.2 or `latest` to use the latest version"
|
||||
description: "version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version"
|
||||
required: false
|
||||
args:
|
||||
description: "golangci-lint command line arguments"
|
||||
|
15
dist/post_run/index.js
vendored
15
dist/post_run/index.js
vendored
@ -2099,9 +2099,6 @@ const getRequestedLintVersion = () => {
|
||||
if (parsedRequestedLintVersion == null) {
|
||||
return null;
|
||||
}
|
||||
if (parsedRequestedLintVersion.patch !== null) {
|
||||
throw new Error(`requested golangci-lint version '${requestedLintVersion}' was specified with the patch version, need specify only minor version`);
|
||||
}
|
||||
if (isLessVersion(parsedRequestedLintVersion, minVersion)) {
|
||||
throw new Error(`requested golangci-lint version '${requestedLintVersion}' isn't supported: we support only ${exports.stringifyVersion(minVersion)} and later versions`);
|
||||
}
|
||||
@ -2128,13 +2125,23 @@ const getConfig = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
function findLintVersion() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info(`Finding needed golangci-lint version...`);
|
||||
const reqLintVersion = getRequestedLintVersion();
|
||||
// if the patched version is passed, just use it
|
||||
if ((reqLintVersion === null || reqLintVersion === void 0 ? void 0 : reqLintVersion.major) !== null && (reqLintVersion === null || reqLintVersion === void 0 ? void 0 : reqLintVersion.minor) != null && (reqLintVersion === null || reqLintVersion === void 0 ? void 0 : reqLintVersion.patch) !== null) {
|
||||
return new Promise((resolve) => {
|
||||
const versionWithoutV = `${reqLintVersion.major}.${reqLintVersion.minor}.${reqLintVersion.patch}`;
|
||||
resolve({
|
||||
TargetVersion: `v${versionWithoutV}`,
|
||||
AssetURL: `https://github.com/golangci/golangci-lint/releases/download/v${versionWithoutV}/golangci-lint-${versionWithoutV}-linux-amd64.tar.gz`,
|
||||
});
|
||||
});
|
||||
}
|
||||
const startedAt = Date.now();
|
||||
const config = yield getConfig();
|
||||
if (!config.MinorVersionToConfig) {
|
||||
core.warning(JSON.stringify(config));
|
||||
throw new Error(`invalid config: no MinorVersionToConfig field`);
|
||||
}
|
||||
const reqLintVersion = getRequestedLintVersion();
|
||||
const versionConfig = config.MinorVersionToConfig[exports.stringifyVersion(reqLintVersion)];
|
||||
if (!versionConfig) {
|
||||
throw new Error(`requested golangci-lint version '${exports.stringifyVersion(reqLintVersion)}' doesn't exist`);
|
||||
|
15
dist/run/index.js
vendored
15
dist/run/index.js
vendored
@ -2099,9 +2099,6 @@ const getRequestedLintVersion = () => {
|
||||
if (parsedRequestedLintVersion == null) {
|
||||
return null;
|
||||
}
|
||||
if (parsedRequestedLintVersion.patch !== null) {
|
||||
throw new Error(`requested golangci-lint version '${requestedLintVersion}' was specified with the patch version, need specify only minor version`);
|
||||
}
|
||||
if (isLessVersion(parsedRequestedLintVersion, minVersion)) {
|
||||
throw new Error(`requested golangci-lint version '${requestedLintVersion}' isn't supported: we support only ${exports.stringifyVersion(minVersion)} and later versions`);
|
||||
}
|
||||
@ -2128,13 +2125,23 @@ const getConfig = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
function findLintVersion() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.info(`Finding needed golangci-lint version...`);
|
||||
const reqLintVersion = getRequestedLintVersion();
|
||||
// if the patched version is passed, just use it
|
||||
if ((reqLintVersion === null || reqLintVersion === void 0 ? void 0 : reqLintVersion.major) !== null && (reqLintVersion === null || reqLintVersion === void 0 ? void 0 : reqLintVersion.minor) != null && (reqLintVersion === null || reqLintVersion === void 0 ? void 0 : reqLintVersion.patch) !== null) {
|
||||
return new Promise((resolve) => {
|
||||
const versionWithoutV = `${reqLintVersion.major}.${reqLintVersion.minor}.${reqLintVersion.patch}`;
|
||||
resolve({
|
||||
TargetVersion: `v${versionWithoutV}`,
|
||||
AssetURL: `https://github.com/golangci/golangci-lint/releases/download/v${versionWithoutV}/golangci-lint-${versionWithoutV}-linux-amd64.tar.gz`,
|
||||
});
|
||||
});
|
||||
}
|
||||
const startedAt = Date.now();
|
||||
const config = yield getConfig();
|
||||
if (!config.MinorVersionToConfig) {
|
||||
core.warning(JSON.stringify(config));
|
||||
throw new Error(`invalid config: no MinorVersionToConfig field`);
|
||||
}
|
||||
const reqLintVersion = getRequestedLintVersion();
|
||||
const versionConfig = config.MinorVersionToConfig[exports.stringifyVersion(reqLintVersion)];
|
||||
if (!versionConfig) {
|
||||
throw new Error(`requested golangci-lint version '${exports.stringifyVersion(reqLintVersion)}' doesn't exist`);
|
||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@ -417,9 +417,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.11.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.2.tgz",
|
||||
"integrity": "sha512-jiE3QIxJ8JLNcb1Ps6rDbysDhN4xa8DJJvuC9prr6w+1tIh+QAbYyNF3tyiZNLDBIuBCf4KEcV2UvQm/V60xfA=="
|
||||
"version": "14.11.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.11.10.tgz",
|
||||
"integrity": "sha512-yV1nWZPlMFpoXyoknm4S56y2nlTAuFYaJuQtYRAOU7xA/FJ9RY0Xm7QOkaYMMmr8ESdHIuUb6oQgR/0+2NqlyA=="
|
||||
},
|
||||
"@types/node-fetch": {
|
||||
"version": "2.5.7",
|
||||
@ -940,9 +940,9 @@
|
||||
}
|
||||
},
|
||||
"eslint-config-prettier": {
|
||||
"version": "6.12.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.12.0.tgz",
|
||||
"integrity": "sha512-9jWPlFlgNwRUYVoujvWTQ1aMO8o6648r+K7qU7K5Jmkbyqav1fuEZC0COYpGBxyiAJb65Ra9hrmFx19xRGwXWw==",
|
||||
"version": "6.13.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.13.0.tgz",
|
||||
"integrity": "sha512-LcT0i0LSmnzqK2t764pyIt7kKH2AuuqKRTtJTdddWxOiUja9HdG5GXBVF2gmCTvVYWVsTu8J2MhJLVGRh+pj8w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"get-stdin": "^6.0.0"
|
||||
|
@ -16,7 +16,8 @@
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"all": "npm run prepare-deps && npm run build && npm run format-check && npm run lint",
|
||||
"local": "npm run build && act -j test -b"
|
||||
"local": "npm run build && act -j test -b",
|
||||
"local-full-version": "npm run build && act -j test-full-version -b"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -36,13 +37,13 @@
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^14.11.2",
|
||||
"@types/node": "^14.11.10",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"@typescript-eslint/eslint-plugin": "^2.34.0",
|
||||
"@typescript-eslint/parser": "^2.34.0",
|
||||
"@zeit/ncc": "^0.22.3",
|
||||
"eslint": "^6.6.0",
|
||||
"eslint-config-prettier": "^6.12.0",
|
||||
"eslint-config-prettier": "^6.13.0",
|
||||
"eslint-plugin-import": "^2.22.1",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"eslint-plugin-simple-import-sort": "^5.0.2",
|
||||
|
@ -61,11 +61,6 @@ const getRequestedLintVersion = (): Version => {
|
||||
if (parsedRequestedLintVersion == null) {
|
||||
return null
|
||||
}
|
||||
if (parsedRequestedLintVersion.patch !== null) {
|
||||
throw new Error(
|
||||
`requested golangci-lint version '${requestedLintVersion}' was specified with the patch version, need specify only minor version`
|
||||
)
|
||||
}
|
||||
if (isLessVersion(parsedRequestedLintVersion, minVersion)) {
|
||||
throw new Error(
|
||||
`requested golangci-lint version '${requestedLintVersion}' isn't supported: we support only ${stringifyVersion(
|
||||
@ -109,6 +104,17 @@ const getConfig = async (): Promise<Config> => {
|
||||
|
||||
export async function findLintVersion(): Promise<VersionConfig> {
|
||||
core.info(`Finding needed golangci-lint version...`)
|
||||
const reqLintVersion = getRequestedLintVersion()
|
||||
// if the patched version is passed, just use it
|
||||
if (reqLintVersion?.major !== null && reqLintVersion?.minor != null && reqLintVersion?.patch !== null) {
|
||||
return new Promise((resolve) => {
|
||||
const versionWithoutV = `${reqLintVersion.major}.${reqLintVersion.minor}.${reqLintVersion.patch}`
|
||||
resolve({
|
||||
TargetVersion: `v${versionWithoutV}`,
|
||||
AssetURL: `https://github.com/golangci/golangci-lint/releases/download/v${versionWithoutV}/golangci-lint-${versionWithoutV}-linux-amd64.tar.gz`,
|
||||
})
|
||||
})
|
||||
}
|
||||
const startedAt = Date.now()
|
||||
|
||||
const config = await getConfig()
|
||||
@ -117,7 +123,6 @@ export async function findLintVersion(): Promise<VersionConfig> {
|
||||
throw new Error(`invalid config: no MinorVersionToConfig field`)
|
||||
}
|
||||
|
||||
const reqLintVersion = getRequestedLintVersion()
|
||||
const versionConfig = config.MinorVersionToConfig[stringifyVersion(reqLintVersion)]
|
||||
if (!versionConfig) {
|
||||
throw new Error(`requested golangci-lint version '${stringifyVersion(reqLintVersion)}' doesn't exist`)
|
||||
|
Reference in New Issue
Block a user