-
Notifications
You must be signed in to change notification settings - Fork 91
Use CI JOB TOKEN to push code #901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for using GitLab CI Job Tokens as an alternative authentication method for semantic-release operations. The change allows CI pipelines to authenticate using the built-in CI_JOB_TOKEN instead of requiring separate access tokens, while handling the limitations of job tokens around commenting permissions.
- Adds job token detection and appropriate header handling (
JOB-TOKENvsPRIVATE-TOKEN) - Implements validation to require explicit disabling of comment conditions when using job tokens
- Updates documentation and error messages to reflect support for multiple token types
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lib/resolve-config.js | Detects job token usage and sets appropriate token header |
| lib/verify.js | Adds job token validation and uses dynamic token headers |
| lib/publish.js | Uses dynamic token header for API requests |
| lib/success.js | Uses dynamic token header for API requests |
| lib/fail.js | Uses dynamic token header for API requests |
| lib/definitions/errors.js | Updates error messages to include job token information and adds new error for job token comment restrictions |
| test/helpers/mock-gitlab.js | Updates mock to handle both token types |
| test/resolve-config.test.js | Adds test for job token detection |
| test/verify.test.js | Adds tests for job token comment condition validation |
| test/integration.test.js | Adds integration test for job token workflow |
| README.md | Documents job token usage and limitations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@tachyons I'm really struggling with this due to all of the limitations with the job token. Please give me some more days to think about it 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this took so long @tachyons.
I'm fine to go forward with the job token, but I'd like this to be a more conscious decision of the user so that they are not surprised by the limitations. What do you think about introducing a dedicated configuration option for "opting in" to the job token instead of just reusing the existing variable? We might also use the same option to disable unsupported features like issue/MR comments.
|
@arvest-bjoneson I get your point, but the job token does have quite some limitations. Going forward we might add more functionality to the gitlab plugin that does not work with the job token. I want to make very clear that using the job token imposes several restrictions. So to move this forward I kindly ask for two changes:
@tachyons Are you still able and willing to work on this? If not I'll try to take care in the next 1-2 weeks. |
|
@fgreinacher that sounds fair. If @tachyons is unable to respond, I'd be willing to take a crack at this over the next couple of days. Most of the changes are from a branch I had originally created. |
GitLab now supports git push authenticted using CI JOB token. This PR update the authentication logic to also support CI JOB TOKEN when available.