Skip to content

Support dependabot while using private repositories as dependencies#2

Merged
llucax merged 4 commits intofrequenz-floss:v0.x.xfrom
llucax:fix-dependabot
Feb 22, 2024
Merged

Support dependabot while using private repositories as dependencies#2
llucax merged 4 commits intofrequenz-floss:v0.x.xfrom
llucax:fix-dependabot

Conversation

@llucax
Copy link
Copy Markdown
Contributor

@llucax llucax commented Feb 21, 2024

We don't setup credentials if they are empty to allow dependabot to work with private dependencies. A PR created by dependabot won't have access to the secrets, so the inputs will be there but empty, causing to create an credentials file with no username or password, which ends up in an auth error.

Because of this, now credentials are optional, which also allows using the action with public repositories more conveniently.

To use private repos as dependencies, they must be configured in the organization.

If you use dependabot and have private repositories as dependencies, the credentials configured here will have no effect on PRs created by dependabot, as they don't have access to secrets for security reasons.

To fix this, you need to configure your GitHub organization to allow dependabot access to the private repositories you use as dependencies for other projects.

This is particularly important to allow dependabot to work with private
dependencies.  A PR created by dependabot won't have access to the
secrets, so the inputs will be there but empty, causing to create an
credentials file with no username or password, which ends up in an auth
error.

To use private repos as dependencies, they must be configured in the
organization.

For more details see:
* dependabot/dependabot-core#3253 (comment)
* https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/managing-security-and-analysis-settings-for-your-organization#allowing-dependabot-to-access-private-dependencies

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Since we need to support the case where they are empty, we can as well
make them optional, and default empty username and password, so repos
not using private repos as dependencies can use this action with less
clutter.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
Add sections about inputs, dependabot and private repositories as
dependencies, and changelog.

Signed-off-by: Leandro Lucarella <luca-frequenz@llucax.com>
@llucax llucax self-assigned this Feb 21, 2024
@llucax llucax added part:docs Affects the documentation type:bug Something isn't working type:enhancement New feature or enhancement visitble to users labels Feb 21, 2024
@llucax llucax added this to the v0.1.0 milestone Feb 21, 2024
@llucax llucax requested review from a team and shsms and removed request for a team February 21, 2024 13:27
@llucax llucax merged commit 0bb8ba9 into frequenz-floss:v0.x.x Feb 22, 2024
@llucax llucax deleted the fix-dependabot branch February 22, 2024 08:24
@leandro-lucarella-frequenz
Copy link
Copy Markdown
Contributor

Sadly I misunderstood the issue and this is not really fixing it. The org-level config only allows dependabot to search for dependency updates, but once the PR is created and the CI needs to run, then the PR created by dependabot still doesn't have access to the private repo (the workflow provided token is still not good and the job still doesn't have access to secrets).

To fix this for good, we'll need a more complicated solution. See: dependabot/dependabot-core#3253 (comment)

@llucax
Copy link
Copy Markdown
Contributor Author

llucax commented Feb 22, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

part:docs Affects the documentation type:bug Something isn't working type:enhancement New feature or enhancement visitble to users

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants