Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Question: How to handle branch protections with PSR? #1149

Closed as not planned
Closed as not planned
@ichoosetoaccept

Description

@ichoosetoaccept

Question

I'm trying to understand if it's possible to use python-semantic-release in a way that ONLY creates GitHub releases, version tags, and release notes WITHOUT requiring commits/pushes to the main branch.

My use case: I have a protected main branch with required status checks (Codacy). I want semantic-release to run AFTER a PR is merged (meaning all checks have passed), but ONLY to create the release artifacts without modifying the repository.
Current behavior: The tool attempts to commit and push changes even when I think I've configured it not to, causing failures due to branch protection rules.

Is there a way to achieve this, or is committing/pushing an essential part of semantic-release's workflow that cannot be bypassed?

The original authors of the semantic-release project strongly recommend against altering project state during a release and I'm trying to heed their advice.

Configuration

Additional context

I've tried various combinations of the GitHub Action configuration, including removing explicit commit: false and push: false settings, but python-semantic-release still attempts to push changes. My GitHub workflow is configured to run on PR merge to main (see Configuration above).

Here's a full log with -vv active. It shows that version detection is working perfectly but it never creates a Github release with release notes and a version bump.

I was able to get the desired outcome once earlier but that was before I added a branch protection ruleset to protect the main branch:

  • Release 0.1.0 was created on: 2025-01-20T09:58:01Z
  • The ruleset was created on: 2025-01-20T12:38:33.202+01:00 (about 2.5 hours after the release)

The ruleset "Protect main" includes:

  • Protection against branch deletion
  • Required status checks from Codacy Static Code Analysis
  • Nothing else

But since it was created after release 0.1.0, it wasn't enforcing any protection at the time of the release.
Adding branch protection for the main branch broke things.

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