codacy / codacy-analysis-cli-action

GitHub Action for the codacy-analysis-cli
https://github.com/codacy/codacy-analysis-cli
Apache License 2.0
56 stars 18 forks source link

[TCE-1038] Project token passed through environment variable `CODACY_PROJECT_TOKEN` is empty #128

Open amedee opened 3 weeks ago

amedee commented 3 weeks ago

This is my .github/workflows/codacy.yml:

---
name: Codacy Security Scan

on:
  schedule:
    - cron: '19 8 * * 2'
  workflow_call:
  workflow_dispatch:

permissions:
  contents: read

jobs:
  codacy-security-scan:
    permissions:
      actions: read
      contents: read
      security-events: write
    name: Codacy Security Scan
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Run Codacy Analysis CLI
        uses: codacy/codacy-analysis-cli-action@3ff8e64eb4b714c4bee91b7b4eea31c6fc2c4f93
        with:
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          verbose: true
          output: results.sarif
          format: sarif
          gh-code-scanning-compat: true
          max-allowed-issues: 2147483647

      - name: Upload SARIF results file
        uses: github/codeql-action/upload-sarif@v3
        with:
          sarif_file: results.sarif

In GitHub, on the page .../settings/secrets/actions, I have defined a repository secret CODACY_PROJECT_TOKEN, with the value I took from the page "Setting up code coverage" on https://app.codacy.com/.

When running this job, I get this error:

07/08 22:52:16 INFO  c.c.a.c.c.Environment:72 - Project token not passed through argument `--project-token` 
07/08 22:52:16 INFO  c.c.a.c.c.Environment:72 - API token not passed through argument `--api-token` 
07/08 22:52:16 WARN  c.c.a.c.c.Environment:77 - Project token passed through environment variable `CODACY_PROJECT_TOKEN` is empty 
07/08 22:52:16 WARN  c.c.a.c.c.Environment:77 - API token passed through environment variable `CODACY_API_TOKEN` is empty 
07/08 22:52:16 WARN  c.c.a.cli.clients.Credentials:30 - Could not retrieve credentials 

How do I fix this?

github-actions[bot] commented 3 weeks ago

Internal ticket created : TCE-1038