Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TCE-897] Pull-Request from contributors can't find CODACY_PROJECT_TOKEN #84

Open
asturio opened this issue Mar 27, 2024 · 5 comments
Open
Labels
jira-issue Issue tracked on JIRA

Comments

@asturio
Copy link

asturio commented Mar 27, 2024

I setup this file in GitHub to report the coverage to codacy:
https://github.com/LibrePDF/OpenPDF/blob/master/.github/workflows/maven.yml
the relevant part is this:

  codacy-coverage-reporter:
    runs-on: ubuntu-latest
    name: Java 17 and codacy-coverage-reporter
    steps:
      - uses: actions/checkout@v4.1.1
      - name: Setup java
        uses: actions/setup-java@v4
        with:
          distribution: temurin
          java-version: 17
      - name: Build with Maven
        run: mvn -B verify --file pom.xml
      - name: Run codacy-coverage-reporter
        uses: codacy/codacy-coverage-reporter-action@v1
        with:
          project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
          coverage-reports: ./openpdf/target/site/jacoco/jacoco.xml,./pdf-toolbox/target/site/jacoco/jacoco.xml,./openpdf-fonts-extra/target/site/jacoco/jacoco.xml

This works great when pushes or PRs are from branches of the repository itself. But when someone clones the repository and create a pull request, than the CODACY_PROJECT_TOKEN is not found, even when the action is executed in my repository.

Like in this case:
https://github.com/LibrePDF/OpenPDF/actions/runs/8409782739

This is the error code:

codacy-coverage-reporter-linux: OK
2024-03-24 13:52:01.253Z error [CodacyCoverageReporter] Invalid configuration: Either a project or account API token must be provided or available in an environment variable  - (CodacyCoverageReporter.scala:28)

 --> Failed!
Error: Process completed with exit code 1.

Is this a bug in the reporter or a problem in my configuration?

@github-actions github-actions bot added the jira-issue Issue tracked on JIRA label Mar 27, 2024
@github-actions github-actions bot changed the title Pull-Request from contributors can't find CODACY_PROJECT_TOKEN [TCE-897] Pull-Request from contributors can't find CODACY_PROJECT_TOKEN Mar 27, 2024
Copy link

Internal ticket created : TCE-897

@vitalijr2
Copy link
Contributor

I have met same issue:

Codacy / Codacy Coverage Reporter (pull_request)
Codacy / Codacy Coverage Reporter (push)

Both actions fall with message: ... error [CodacyCoverageReporter] Invalid configuration: Either a project or account API token must be provided or available in an environment variable - (CodacyCoverageReporter.scala:28)

@vitalijr2
Copy link
Contributor

@asturio there is strange behavior of the action: I just run it again and workflows are green, see codacy/codacy-coverage-reporter#502 (comment)

@vitalijr2
Copy link
Contributor

Update: how I have resolved similar issue codacy/codacy-coverage-reporter#502 (comment)

@vitalijr2
Copy link
Contributor

vitalijr2 commented Jun 17, 2024

Update: how I have resolved similar issue codacy/codacy-coverage-reporter#502 (comment)

I was wrong: it was happend last day
See [TCE-969 Pull request and push are failed: project or account API token not found
](codacy/codacy-coverage-reporter#502 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira-issue Issue tracked on JIRA
Projects
None yet
Development

No branches or pull requests

2 participants