mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-02-08 00:37:26 +00:00
feat: use absolute paths by default when using working-directory option
This commit is contained in:
parent
16ece5e01d
commit
ef5dc4758d
4 changed files with 30 additions and 29 deletions
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
|
|
@ -54,8 +54,8 @@ jobs:
|
|||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v2.0"
|
||||
- "v2.0.0"
|
||||
- "v2.1"
|
||||
- "v2.1.0"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
@ -83,8 +83,8 @@ jobs:
|
|||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v2.0.0"
|
||||
- "1f032fbc4b117e4247b19ff606cc847ab5383bc9"
|
||||
- "v2.1.0"
|
||||
- "f6c2e6c999dfae444d1fe7f1b0d49becdae44547"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
|
|
|
|||
39
README.md
39
README.md
|
|
@ -54,9 +54,9 @@ jobs:
|
|||
with:
|
||||
go-version: stable
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: v2.0
|
||||
version: v2.1
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
@ -92,9 +92,9 @@ jobs:
|
|||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: v2.0
|
||||
version: v2.1
|
||||
```
|
||||
|
||||
You will also likely need to add the following `.gitattributes` file to ensure that line endings for Windows builds are properly formatted:
|
||||
|
|
@ -147,11 +147,10 @@ jobs:
|
|||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- name: golangci-lint ${{ matrix.modules }}
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
||||
working-directory: ${{ matrix.modules }}
|
||||
args: --path-mode=abs
|
||||
```
|
||||
|
||||
</details>
|
||||
|
|
@ -230,11 +229,10 @@ jobs:
|
|||
with:
|
||||
go-version: ${{ inputs.go-version }}
|
||||
- name: golangci-lint ${{ matrix.modules }}
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: ${{ inputs.golangci-lint-version }}
|
||||
working-directory: ${{ matrix.modules }}
|
||||
args: --path-mode=abs
|
||||
```
|
||||
|
||||
You will also likely need to add the following `.gitattributes` file to ensure that line endings for Windows builds are properly formatted:
|
||||
|
|
@ -247,6 +245,7 @@ You will also likely need to add the following `.gitattributes` file to ensure t
|
|||
|
||||
## Compatibility
|
||||
|
||||
* `v8.0.0` works with `golangci-lint` version >= `v2.1.0`
|
||||
* `v7.0.0` supports golangci-lint v2 only.
|
||||
* `v6.0.0+` removes `annotations` option, removes the default output format (`github-actions`).
|
||||
* `v5.0.0+` removes `skip-pkg-cache` and `skip-build-cache` because the cache related to Go itself is already handled by `actions/setup-go`.
|
||||
|
|
@ -273,9 +272,9 @@ When `install-mode` is:
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
version: v2.0
|
||||
version: v2.1
|
||||
# ...
|
||||
```
|
||||
|
||||
|
|
@ -293,7 +292,7 @@ The default value is `binary`.
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
install-mode: "goinstall"
|
||||
# ...
|
||||
|
|
@ -313,7 +312,7 @@ By default, it uses the `github.token` from the action.
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
github-token: xxx
|
||||
# ...
|
||||
|
|
@ -336,7 +335,7 @@ The JSON Schema used to validate the configuration depends on the version of gol
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
verify: false
|
||||
# ...
|
||||
|
|
@ -361,7 +360,7 @@ The default value is `false`.
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
only-new-issues: true
|
||||
# ...
|
||||
|
|
@ -379,7 +378,7 @@ Working directory, useful for monorepos.
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
working-directory: somedir
|
||||
# ...
|
||||
|
|
@ -404,7 +403,7 @@ golangci-lint command line arguments.
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
# In some rare cases,
|
||||
# you could have to use `${{ github.workspace }}` as base directory to reference your configuration file.
|
||||
|
|
@ -432,7 +431,7 @@ The default value is `false`.
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
problem-matchers: true
|
||||
# ...
|
||||
|
|
@ -453,7 +452,7 @@ The default value is `false`.
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
skip-cache: true
|
||||
# ...
|
||||
|
|
@ -473,7 +472,7 @@ The default value is `false`.
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
skip-save-cache: true
|
||||
# ...
|
||||
|
|
@ -495,7 +494,7 @@ If the number is `<= 0`, the cache will always be invalidated (Not recommended).
|
|||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
uses: golangci/golangci-lint-action@v8
|
||||
with:
|
||||
cache-invalidation-interval: 15
|
||||
# ...
|
||||
|
|
|
|||
|
|
@ -123,9 +123,11 @@ async function runLint(binPath: string, patchPath: string): Promise<void> {
|
|||
if (!fs.existsSync(workingDirectory) || !fs.lstatSync(workingDirectory).isDirectory()) {
|
||||
throw new Error(`working-directory (${workingDirectory}) was not a path`)
|
||||
}
|
||||
if (!userArgNames.has(`path-prefix`)) {
|
||||
addedArgs.push(`--path-prefix=${workingDirectory}`)
|
||||
|
||||
if (!userArgNames.has(`path-prefix`) && !userArgNames.has(`path-mode`)) {
|
||||
addedArgs.push(`--path-mode=abs`)
|
||||
}
|
||||
|
||||
cmdArgs.cwd = path.resolve(workingDirectory)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const parseVersion = (s: string): Version => {
|
|||
}
|
||||
|
||||
if (parseInt(match[1]) !== 2) {
|
||||
throw new Error(`invalid version string '${s}', golangci-lint v${match[1]} is not supported by golangci-lint-action v7.`)
|
||||
throw new Error(`invalid version string '${s}', golangci-lint v${match[1]} is not supported by golangci-lint-action >= v7.`)
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
@ -45,7 +45,7 @@ export const stringifyVersion = (v: Version): string => {
|
|||
|
||||
const minVersion = {
|
||||
major: 2,
|
||||
minor: 0,
|
||||
minor: 1,
|
||||
patch: 0,
|
||||
}
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ const isLessVersion = (a: Version, b: Version): boolean => {
|
|||
return a.major < b.major
|
||||
}
|
||||
|
||||
// Do not compare patch parts because if the min version has a non zero value
|
||||
// Do not compare patch parts because if the min version has a non-zero value
|
||||
// then it returns false, since the patch version of requested is always zero
|
||||
return a.minor < b.minor
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue