Using semantic-release with an SSH deploy key in GitHub Actions
We use semantic-release to release new versions of one of our JavaScript-based web applications.
semantic-release can help with various release-based activities, such as figuring out the version bump based on the commit history using conventional commits, updating the changelog, pushing a new version tag, and so on.
We recently migrated our repositories to GitHub and have a ruleset enabled for the main (default) branch to protect this branch.
Using a ruleset is basically the new way of protecting a branch.
For a single developer or a very small team this might be overkill and slow you down.
For bigger teams definitely it makes sense to ensure that certain practices are adhered to.
For example, you can enforce that force pushes are getting blocked, or that a pull request is required before merging.
This is where we ran into issues where the release commit by semantic-release could not be pushed directly to main due to this rule.
GitHub allows you to grant bypass permissions for your ruleset.
Unfortunately, you cannot add a single user to this bypass list, and the GITHUB_TOKEN secret is associated with the (special) github-actions[bot] user.
So, how were we able to accomplish this?