codacy / codacy-coverage-reporter-action

GitHub Action for the codacy-coverage-reporter
Other
56 stars 15 forks source link

[CY-4762] Request URL not found. Check if the API Token you are using and the API base URL are valid #46

Closed straumat closed 2 years ago

straumat commented 2 years ago

My project is here: https://github.com/cassandre-tech/cassandre-trading-bot and the workflow I'm using is here: https://github.com/cassandre-tech/cassandre-trading-bot/blob/development/.github/workflows/continuous-integration.yml.

I've added this to my workflow:

      - name: Upload codacy coverage results
        id: upload-codacy-coverage-reporter
        uses: codacy/codacy-coverage-reporter-action@v1.0.1
        with:
          api-token: ${{ secrets.CODACY_API_TOKEN }}
          coverage-reports: spring-boot-starter/autoconfigure/target/site/jacoco/jacoco.xml

I have this error in the CI:

2021-07-20 19:05:28.879Z  info [ConfigurationRules] API base URL: https://api.codacy.com  - (ConfigurationRules.scala:77)
2021-07-20 19:05:28.879Z  info [CommitUUIDProvider] CI/CD provider GitHub Actions found Commit UUID d0ad078d7d827ccb91ff53a2285a5120337393a5  - (CommitUUIDProvider.scala:131)
2021-07-20 19:05:28.879Z  info [ReportRules] Parsing coverage data from: /home/runner/work/***-trading-bot/***-trading-bot/spring-boot-starter/autoconfigure/target/site/jacoco/jacoco.xml ...  - (ReportRules.scala:43)
2021-07-20 19:05:28.992Z  info [ReportRules] Coverage parser used is com.codacy.parsers.implementation.JacocoParser$@2aa6dbcd  - (ReportRules.scala:48)
2021-07-20 19:05:28.998Z  info [ReportRules] Generated coverage report: /tmp/codacy-coverage-1822594183112371518.json (32.19 kB)  - (ReportRules.scala:256)
2021-07-20 19:05:28.998Z  info [ReportRules] Uploading coverage data...  - (ReportRules.scala:257)
2021-07-20 19:05:29.412Z  info [ReportRules] 
To complete the reporting process, call coverage-reporter with the final flag.
 Check https://docs.codacy.com/coverage-reporter/#multiple-reports
 for more information.  - (ReportRules.scala:82)
2021-07-20 19:05:29.412Z error [CodacyCoverageReporter] Failed to upload coverage report /home/runner/work/***-trading-bot/***-trading-bot/spring-boot-starter/autoconfigure/target/site/jacoco/jacoco.xml: Request URL not found. Check if the API Token you are using and the API base URL are valid.  - (CodacyCoverageReporter.scala:25)
github-actions[bot] commented 2 years ago

Internal ticket created : CY-4762

machadoit commented 2 years ago

In the meanwhile it seems that you've changed to use the script instead of the action, correct? Everything is working now?

Related to the issue, it seems that what maybe cause the problem was a misalignment between CODACY_PROJECT_TOKEN and CODACY_API_TOKEN that have scopes of a repository or your account respectively.

I can see that you do --project-token ${{ secrets.CODACY_API_TOKEN }} which is fine, as you can call the secret as you prefer on your repository, but on the action you were passing it as api-token:. Assuming that you didn't change the token, and it was always a repository level token, the necessary change to be able to use the action would be project-token:: ${{ secrets.CODACY_API_TOKEN }}.

Let me know if you are still facing problems uploading coverage.

straumat commented 2 years ago

Yes! everything is working now! i can close the issue