diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1f73f47..b767226 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/README.md b/README.md index d8f77ec..745017e 100644 --- a/README.md +++ b/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 ``` @@ -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 ``` @@ -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: Example ```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`. Example ```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. Example ```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 Example ```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`. Example ```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. Example ```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. Example ```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`. Example ```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`. Example ```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`. Example ```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). Example ```yml -uses: golangci/golangci-lint-action@v7 +uses: golangci/golangci-lint-action@v8 with: cache-invalidation-interval: 15 # ... diff --git a/src/run.ts b/src/run.ts index db02b3f..6418ab5 100644 --- a/src/run.ts +++ b/src/run.ts @@ -123,9 +123,11 @@ async function runLint(binPath: string, patchPath: string): Promise { 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) } diff --git a/src/version.ts b/src/version.ts index 1860007..e8ae68a 100644 --- a/src/version.ts +++ b/src/version.ts @@ -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 }