ansys / ansys/pyansys-dev-guide
Add instructions for using tokens in CI with poetry
- Dominant language
- No language data
- Stars
- 41
- Forks
- 9
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 12
Description
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
```toml
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
```bash
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.
Contributor guide
Research direction
The issue references pyproject.toml and a git config workaround for a private GitHub dependency; start by locating the packaging guide and any CI documentation in this repository. Document the token-based URL rewrite for Poetry dependencies, including how to use a CI secret without hard-coding it in pyproject.toml.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, github, python
- Domain
- ci-cd, documentation, security
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100