Skip to content

Add instructions for using tokens in CI with poetry #53

@greschd

Description

@greschd

When depending on a private repository with poetry, it is not straightforward how to include this in CI:

In the pyproject.toml, the dependency is specified as

package_name = { git = "https://github.com/organization/repository",  branch = "branch_name" }

This works for local installs where the user is authenticated to GitHub, but on CI poetry doesn't recognize / use the token. As a workaround, we can use

git config --global url."https://${{ secrets.TOKEN_NAME }}@github.com/organization/repository".insteadOf "https://github.com/organization/repository"

to let git prepend the token whenever the given URL is encountered. In this way, token authentication can be used without having to hard-code (and, depending on current or future repo visibility, leak the token) in pyproject.tml.

This workaround should be documented, but it's not obvious where to do so; it's a bit too niche to belong in the general packaging guide IMO.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions