codacy / codacy-coverage-reporter-action

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

[CY-4719] Error when running CI for Dependabot PRs #45

Closed twschiller closed 2 years ago

twschiller commented 3 years ago

Is there any special configuration/setup required for using with Dependabot?

We're getting the following error:

2021-07-12 22:27:35.255Z error [CodacyCoverageReporter] Invalid configuration: Either a project or account API token must be provided or available in an environment variable  - (CodacyCoverageReporter.scala:25)

And the relevant portion of our CI configuration:

name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
with:
  project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
  coverage-reports: cobertura.xml
github-actions[bot] commented 3 years ago

Internal ticket created : CY-4719

machadoit commented 2 years ago

Hi @twschiller, unfortunately there are some behaviours that changed regarding Dependabot, please check this compiled FAQ https://github.com/dependabot/dependabot-core/issues/3253#issuecomment-852541544

That said, here the concrete problem, is that the action triggered by dependabot cannot access your secrets.CODACY_PROJECT_TOKEN. On the FAQ, there are multiple options, although at the moment there are no perfect ones.

Alternatively, you can add a github.actor != 'dependabot[bot]' on your action, to avoid it getting triggered by dependabot.

twschiller commented 2 years ago

Thanks, we're currently using github.actor != 'dependabot[bot]' and will continue to go that route