Use environments to limit the scope of tokens in CI/CD
- Dominant language
- Python
- Stars
- 37
- Forks
- 7
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 19
Description
Our CI/CD pipelines run a series of jobs: labeling, code-style, docs-style, tests, build, and release. Not all these jobs required access to environment variables like the `GITHUB_TOKEN` or the `ANSYSLMD_LICENSE_SERVER`.
It is possible to declare the scope of these secrets by using GitHub environments:
- https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment
Furthermore, these environments can define specific rules. For example, rules for branch names or tagging. You can even force `CODEOWNERS` to review and approve some of these jobs before they even run!
All these would protect even more our CI/CD pipelines, not only from the outside but also from our own mistakes.
Contributor guide
Research direction
Start by locating the GitHub Actions workflow definitions for the labeling, code-style, docs-style, tests, build, and release jobs, then review GitHub's environments documentation linked in the issue. Done means jobs receive only the environment variables they require, with environment rules applied where appropriate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd, security
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100