From b9140df8679b0b456993ed50d16ac32cab1b6c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udia?= Date: Fri, 6 Nov 2026 09:16:56 +0000 Subject: [PATCH 1/2] docs: use the Codacy Analysis CLI GitHub Action on the ESLint page [OD-487] Co-Authored-By: Claude Opus 5.5 --- .../local-analysis/running-eslint.md | 48 +++++++++++-------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/docs/repositories-configure/local-analysis/running-eslint.md b/docs/repositories-configure/local-analysis/running-eslint.md index 72fd837846..a916582d37 100644 --- a/docs/repositories-configure/local-analysis/running-eslint.md +++ b/docs/repositories-configure/local-analysis/running-eslint.md @@ -44,39 +44,45 @@ codacy-analysis upload eslint.sarif --commit $COMMIT_SHA --repository ## GitHub Action -The GitHub Action still uses [Codacy CLI v2](https://github.com/codacy/codacy-cli-v2), a separate tool from the `codacy-analysis` CLI used above. It reads its runtime and tool versions from a `.codacy/codacy.yaml` file in your repository: - -```yaml -runtimes: - - node@22.2.0 -tools: - - eslint@9.3.0 -``` +The [Codacy Analysis CLI GitHub Action](https://github.com/codacy/analysis-cli-action) runs the same `codacy-analysis` CLI as the manual configuration above. If your repository has no committed `.codacy/codacy.config.json`, the action fetches the repository's configuration from Codacy with your token. +On `pull_request` events, the action uploads the results for the pull request's head commit. Check out that commit with `ref:` as in the examples below, otherwise line numbers can point at the wrong lines. ### Using a project token + +{% raw %} ```yml -- name: Run Codacy CLI - uses: codacy/codacy-cli-v2-action@main +- uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + +- name: Run Codacy Analysis CLI + uses: codacy/analysis-cli-action@v1 with: - project-token: CODACY_PROJECT_TOKEN - tool: eslint - upload_report: true + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + tool: ESLint9 + upload: true ``` +{% endraw %} ### Using an account API token +The action takes the provider, organization, and repository from the workflow. Set `provider`, `owner`, and `repository` only if the repository is on Codacy under different names. + +{% raw %} ```yml -- name: Run Codacy CLI - uses: codacy/codacy-cli-v2-action@main +- uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + +- name: Run Codacy Analysis CLI + uses: codacy/analysis-cli-action@v1 with: - api_token: CODACY_API_TOKEN - tool: eslint - upload_report: true - provider: gh - owner: codacy-acme - repository: sample-javascript-project + api-token: ${{ secrets.CODACY_API_TOKEN }} + tool: ESLint9 + upload: true ``` +{% endraw %} !!! warning "Tokens should be stored in the repository secrets." From ed7ada51630284c9a3e51f0db717a8db39c8959c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A1udia?= Date: Fri, 6 Nov 2026 10:09:27 +0000 Subject: [PATCH 2/2] docs: use lowercase eslint9 in the GitHub Action examples [OD-487] Matches the --tool value in the manual configuration section above. Co-Authored-By: Claude Opus 5.5 --- docs/repositories-configure/local-analysis/running-eslint.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/repositories-configure/local-analysis/running-eslint.md b/docs/repositories-configure/local-analysis/running-eslint.md index a916582d37..97e92261a5 100644 --- a/docs/repositories-configure/local-analysis/running-eslint.md +++ b/docs/repositories-configure/local-analysis/running-eslint.md @@ -60,7 +60,7 @@ On `pull_request` events, the action uploads the results for the pull request's uses: codacy/analysis-cli-action@v1 with: project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} - tool: ESLint9 + tool: eslint9 upload: true ``` {% endraw %} @@ -79,7 +79,7 @@ The action takes the provider, organization, and repository from the workflow. S uses: codacy/analysis-cli-action@v1 with: api-token: ${{ secrets.CODACY_API_TOKEN }} - tool: ESLint9 + tool: eslint9 upload: true ``` {% endraw %}