Skip to content

Feature request: Support git push options #973

Open

Description

@mmomper

Description

It would be nice to support git push options (added in Git 2.10.2). Preferable separated for the commit push and the tag push.

Use cases

We are using GitLab CI/CD and want to use this tool for version management but don't want a pipeline run for the version bump commit. This could be archived by using the push option ci.skip for the new commit.

Adding [skip ci] to every commit has also impact on everything else referencing this commit (for example the tag).

Possible implementation

I tested that it works by simply modifying the commit push line from repo.git.push(remote_url, branch) to repo.git.push(remote_url, branch, "-o", "ci.skip") and it works.

I did not create a PR because I'm unsure which is the best option for adding this as a cli/config parameter.

Activity

  1. added
    feature
    on Jul 5, 2024
  2. codejedi365 commented on Jul 7, 2024

    @codejedi365
    Contributor

    Hi @mmomper,

    Thank you for submitting this feature request. I've been dwelling on what is the best course of action here. I can understand the need for PSR providing some level of triggering support for skip ci flags.

    My hesitation with your recommended implementation is that we support more than one hosted version control system (HVCS) and my cursory look is that GitHub does not support push options but GitLab does. I have not looked into Gitea or BitBucket's compatibility yet but that could be different as well. This leads me to consider a configuration option that basically defines which type of skip ci do you want to apply (push options or a commit message label). I personally don't quite want to get into the game of just inserting arbitrary user command switches for every internal command we provide as it seems quite messy as we have a few of those already. It stands to question what is the benefit of the package in the first place, but I digress. This is one motivation to instead consider the action we apply and handle that use. I think skip CI is something PSR needs to be cognizant of as we are generally triggering secondary CI workflows and running from within a CI environment, generally.

    Prior to reading up on push options, my recommendation would have been to use the commit_message configuration option to customize the commit message to include a [skip ci] entry which has wider support including GitLab. However, based on your comment below, you seem to have some hesitation here?

    Adding [skip ci] to every commit has also impact on everything else referencing this commit (for example the tag).

    Can you expand upon the problem with this?

    When I work with GitLab CI, generally if I'm using a semantic-release tool in a job, then I use the workflow:rules directive to turn off CI pipelines on any tags via the $CI_COMMIT_TAG variable. This is how I would handle the tag environment so would a push-option on the git push tag be necessary? The commit would need the [skip ci] tag in the commit message if I am writing back to the repository to prevent a subsequent workflow.

  3. mmomper commented on Jul 8, 2024

    @mmomper
    Author

    Hi @codejedi365 ,

    Thanks for the reply and thoughts about it. First of all, my issue with the [skip ci] in the message is the following:

    When the new commit is created and pushed, the CI gets skipped, as intended. But when the Tag is created and pushed, the CI for the Tag is also skipped, which may be unintended. I read somewhere that, if this commit is the lates of an MR, the CI for the merge would also be skipped (not my use case but I think it is something to not forget about).

    In my use case, I thought about triggering a CI run on Tags in which the package gets pushed to the JFrog we are using.

    I would agree, creating a switch/config option for every push option is not a good practice since the supported options are not specified by Git but by the HVCS implementation. I thought about a generic flag/config like commit-push-option/tag-push-option, which then gets passed to the call. In this way, the user could add the options he wants for his HVCS and there is no need to implement all of them explicitly.

    Of course this could be archived with not including [skip ci] and using rules to not trigger the back push, but this is something you always have to not forget and maybe include in a job template. In my opinion, the push option would be a cleaner solution for that.

  4. added
    confirmed
    on Sep 2, 2024
  5. github-actions commented on Nov 2, 2024

    @github-actions

    It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

  6. added
    needs-update
    on Nov 2, 2024
  7. codejedi365 commented on Nov 2, 2024

    @codejedi365
    Contributor

    Still in the backlog, haven't gotten back around to the implementation

  8. removed
    needs-update
    on Nov 3, 2024
  9. github-actions commented on Jan 3, 2025

    @github-actions

    It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

  10. added
    needs-update
    on Jan 3, 2025
  11. codejedi365 commented on Jan 3, 2025

    @codejedi365
    Contributor

    Still in backlog

  12. removed
    needs-update
    on Jan 4, 2025
  13. github-actions commented on Mar 5, 2025

    @github-actions

    It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

  14. added
    needs-update
    on Mar 5, 2025
  15. codejedi365 commented on Mar 5, 2025

    @codejedi365
    Contributor

    Still in backlog

  16. removed
    needs-update
    on Mar 6, 2025
  17. github-actions commented on May 5, 2025

    @github-actions

    It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

  18. added
    needs-update
    on May 5, 2025
  19. codejedi365 commented on May 5, 2025

    @codejedi365
    Contributor

    Still in backlog

  20. removed
    needs-update
    on May 6, 2025
  21. github-actions commented on Aug 4, 2025

    @github-actions

    It has been 90 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

  22. added
    needs-update
    on Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmedfeatureneeds-update

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions