Compare commits

..

5 Commits

7 changed files with 39 additions and 28 deletions

View File

@ -23,3 +23,21 @@
* Ensure the PR description clearly describes the problem and solution. * Ensure the PR description clearly describes the problem and solution.
Include the relevant issue number if applicable. Include the relevant issue number if applicable.
## Development of this action
1. Install [act](https://github.com/nektos/act#installation)
2. Make a symlink for `act` to work properly: `ln -s . golangci-lint-action`
3. Install dependencies: `npm install`
4. Build: `npm run build`
5. Run `npm run local` after any change to test it
### Releases
```bash
npm version <major | minor | patch> -m "Upgrade to %s"
```
- https://docs.npmjs.com/cli/v11/commands/npm-version
The "major tag" (ex: `v6`) should be deleted and then recreated manually.

View File

@ -539,11 +539,3 @@ Inside our action, we perform 3 steps:
GitHub matches keys by prefix if we have no exact match for the primary cache. GitHub matches keys by prefix if we have no exact match for the primary cache.
This scheme is basic and needs improvements. Pull requests and ideas are welcome. This scheme is basic and needs improvements. Pull requests and ideas are welcome.
## Development of this action
1. Install [act](https://github.com/nektos/act#installation)
2. Make a symlink for `act` to work properly: `ln -s . golangci-lint-action`
3. Install dependencies: `npm install`
4. Build: `npm run build`
5. Run `npm run local` after any change to test it

8
dist/post_run/index.js generated vendored
View File

@ -93982,7 +93982,7 @@ async function prepareEnv() {
const binPath = await prepareLint(); const binPath = await prepareLint();
const patchPath = await fetchPatch(); const patchPath = await fetchPatch();
core.info(`Prepared env in ${Date.now() - startedAt}ms`); core.info(`Prepared env in ${Date.now() - startedAt}ms`);
return { binPath: binPath, patchPath }; return { binPath, patchPath };
} }
const printOutput = (res) => { const printOutput = (res) => {
if (res.stdout) { if (res.stdout) {
@ -93992,10 +93992,10 @@ const printOutput = (res) => {
core.info(res.stderr); core.info(res.stderr);
} }
}; };
async function runLint(lintPath, patchPath) { async function runLint(binPath, patchPath) {
const debug = core.getInput(`debug`); const debug = core.getInput(`debug`);
if (debug.split(`,`).includes(`cache`)) { if (debug.split(`,`).includes(`cache`)) {
const res = await execShellCommand(`${lintPath} cache status`); const res = await execShellCommand(`${binPath} cache status`);
printOutput(res); printOutput(res);
} }
let userArgs = core.getInput(`args`); let userArgs = core.getInput(`args`);
@ -94068,7 +94068,7 @@ async function runLint(lintPath, patchPath) {
} }
cmdArgs.cwd = path.resolve(workingDirectory); cmdArgs.cwd = path.resolve(workingDirectory);
} }
const cmd = `${lintPath} 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();
try { try {

8
dist/run/index.js generated vendored
View File

@ -93982,7 +93982,7 @@ async function prepareEnv() {
const binPath = await prepareLint(); const binPath = await prepareLint();
const patchPath = await fetchPatch(); const patchPath = await fetchPatch();
core.info(`Prepared env in ${Date.now() - startedAt}ms`); core.info(`Prepared env in ${Date.now() - startedAt}ms`);
return { binPath: binPath, patchPath }; return { binPath, patchPath };
} }
const printOutput = (res) => { const printOutput = (res) => {
if (res.stdout) { if (res.stdout) {
@ -93992,10 +93992,10 @@ const printOutput = (res) => {
core.info(res.stderr); core.info(res.stderr);
} }
}; };
async function runLint(lintPath, patchPath) { async function runLint(binPath, patchPath) {
const debug = core.getInput(`debug`); const debug = core.getInput(`debug`);
if (debug.split(`,`).includes(`cache`)) { if (debug.split(`,`).includes(`cache`)) {
const res = await execShellCommand(`${lintPath} cache status`); const res = await execShellCommand(`${binPath} cache status`);
printOutput(res); printOutput(res);
} }
let userArgs = core.getInput(`args`); let userArgs = core.getInput(`args`);
@ -94068,7 +94068,7 @@ async function runLint(lintPath, patchPath) {
} }
cmdArgs.cwd = path.resolve(workingDirectory); cmdArgs.cwd = path.resolve(workingDirectory);
} }
const cmd = `${lintPath} 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();
try { try {

13
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "golanci-lint-action", "name": "golanci-lint-action",
"version": "6.3.1", "version": "6.3.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "golanci-lint-action", "name": "golanci-lint-action",
"version": "6.3.1", "version": "6.3.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^4.0.0", "@actions/cache": "^4.0.0",
@ -31,7 +31,7 @@
"eslint-plugin-import": "^2.31.0", "eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.3", "eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "^3.4.2", "prettier": "^3.5.0",
"typescript": "^5.7.3" "typescript": "^5.7.3"
} }
}, },
@ -3119,10 +3119,11 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "3.4.2", "version": "3.5.0",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.0.tgz",
"integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", "integrity": "sha512-quyMrVt6svPS7CjQ9gKb3GLEX/rl3BCL2oa/QkNcXv4YNVBC9olt3s+H7ukto06q7B1Qz46PbrKLO34PR6vXcA==",
"dev": true, "dev": true,
"license": "MIT",
"bin": { "bin": {
"prettier": "bin/prettier.cjs" "prettier": "bin/prettier.cjs"
}, },

View File

@ -1,6 +1,6 @@
{ {
"name": "golanci-lint-action", "name": "golanci-lint-action",
"version": "6.3.1", "version": "6.3.2",
"private": true, "private": true,
"description": "golangci-lint github action", "description": "golangci-lint github action",
"main": "dist/main.js", "main": "dist/main.js",
@ -46,7 +46,7 @@
"eslint-plugin-import": "^2.31.0", "eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.3", "eslint-plugin-prettier": "^5.2.3",
"eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-simple-import-sort": "^12.1.1",
"prettier": "^3.4.2", "prettier": "^3.5.0",
"typescript": "^5.7.3" "typescript": "^5.7.3"
} }
} }

View File

@ -156,7 +156,7 @@ async function prepareEnv(): Promise<Env> {
core.info(`Prepared env in ${Date.now() - startedAt}ms`) core.info(`Prepared env in ${Date.now() - startedAt}ms`)
return { binPath: binPath, patchPath } return { binPath, patchPath }
} }
type ExecRes = { type ExecRes = {
@ -173,10 +173,10 @@ const printOutput = (res: ExecRes): void => {
} }
} }
async function runLint(lintPath: string, patchPath: string): Promise<void> { async function runLint(binPath: string, patchPath: string): Promise<void> {
const debug = core.getInput(`debug`) const debug = core.getInput(`debug`)
if (debug.split(`,`).includes(`cache`)) { if (debug.split(`,`).includes(`cache`)) {
const res = await execShellCommand(`${lintPath} cache status`) const res = await execShellCommand(`${binPath} cache status`)
printOutput(res) printOutput(res)
} }
@ -266,7 +266,7 @@ async function runLint(lintPath: string, patchPath: string): Promise<void> {
cmdArgs.cwd = path.resolve(workingDirectory) cmdArgs.cwd = path.resolve(workingDirectory)
} }
const cmd = `${lintPath} 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()}] ...`)