ci(release): pin repositoryUrl to the SSH form - #338
Merged
Conversation
The release push moves to a per-repository write-enabled deploy key, named as the only bypass actor in the default-branch ruleset. This line is what makes SSH get tried at all: get-git-auth-url.js expands a shortcut or HTTPS repository URL before SSH is attempted, so without it the push would keep going over HTTPS and the ruleset would reject it. RSRMID-2994
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira: https://centralnic.atlassian.net/browse/RSRMID-2994
Pins
repositoryUrlto thegit@form so the release push goes over SSH with this repository's deploy key.Why this one line is not optional
semantic-releaseexpands the repository URL before SSH is ever attempted —lib/get-git-auth-url.js:Without an explicit
repositoryUrlthe value comes frompackage.json(agithub:shortcut) or from the checkout'sorigin(HTTPS). Either way it resolves to HTTPS and SSH is never tried, so the push would keep using the personal access token — and the ruleset, whose only bypass actor isDeployKey, would reject it.The other halves of the change
semantic-release, whose private half is the repository secretRTLDEV_MW_CI_SSH_KEY. Exactly one matters: GitHub grants the ruleset bypass to deploy keys as a class, not to one key.DeployKey::alwaysbypass, and classic branch protection is removed in the same step. Classic protection requires a pull request and exempts only admins, so it would reject a deploy key where it accepts today's admin PAT. The ruleset is the stricter of the two: it adds linear history and binds admins as well.GITHUB_TOKENstays in the release step —@semantic-release/githubstill needs it to create the GitHub release. Only the git push moves.