open-sauced / release

nodejs and docker github actions compatible semantic-release shareable config to publish to npmjs.com and ghcr.io
MIT License
14 stars 6 forks source link

Bug: Release process fails if PR approvals are required #17

Closed brandonroberts closed 1 year ago

brandonroberts commented 1 year ago

Describe the bug

Currently, to use this action you must disable required approvals for pull requests. If pull requests are required, the following error occurs

remote: error: GH006: Protected branch update failed for refs/heads/beta.        
remote: error: Changes must be made through a pull request.    

You can allow certain users/apps to bypass this the repository settings, but that has no effect here, even with adding the OpenSauced GitHub app.

A workaround is to install a GitHub app and use an app token

https://github.com/semantic-release/github/issues/175#issuecomment-1489689561

Steps to reproduce

  1. Install and setup the release action - https://github.com/open-sauced/api/blob/beta/.github/workflows/release.yml#L132
  2. Enabled required approvals on the repository - 2
  3. Merge a pull request
  4. Note that the semantic release job fails with the error

Browsers

No response

Additional context (Is this in dev or production?)

No response

Code of Conduct

Contributing Docs

bdougie commented 1 year ago

@brandonroberts I just made you a GitHub App admin for the org if you want to test a fix on a benign repo.

brandonroberts commented 1 year ago

@bdougie verified that the mentioned solution of using the GitHub App with a generated token works successfully.

brandonroberts commented 1 year ago

Adding a note here that GitHub Packages does not currently support deployments using tokens from GitHub Apps, so including a Dockerfile at the root of the project will fail to deploy.

The workaround is to rename it to something.Dockerfile and point to that Dockerfile as the input for the container to be built. This skips the deployment to the GitHub Registry, and you would have to set up a Personal Access token to deploy to ghcr.io.