Skip to content

(dupe) Question: How to handle branch protections with PSR? #1288

Closed
@aaaaahaaaaa

Description

@aaaaahaaaaa

Bug Report

Description

As far as I can tell looking at the implementation, when PSR is committing, it's not authenticating using the token (if provided).

This is a blocker on Github if the target branch is protected by a ruleset (e.g. if there are required checks or if PRs are required). The only solution is to allow certain users to bypass the ruleset, which in the case of PSR, would be to allow the user behind the specified PAT. Which finally would require PSR to authenticate the git push using the provided token.

Unless I'm missing something, I think this a major shortcoming at the moment considering that protected branches is an extremely common feature.

Expected behavior

The git push performed by PSR should be authenticated using the provided token.

Actual behavior

PSR's commit fails if the target branch is protected.

Example output using the official PSR Github Action:

GitCommandError: Cmd('git') failed due to:
exit code(1)
    cmdline: git push
[...]
remote: Review all repository rules at [...]
remote:
remote: - Cannot update this protected ref.
remote:
remote: - Changes must be made through a pull request.
remote:
remote: - 5 of 5 required status checks are expected.
remote:
To [...]  
...

Environment

  • Operating System (w/ version): Github Action
  • Python version:
  • Pip version:
  • Semantic-release version: Latest
  • Build tool (w/ version):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions