Skip to content

Allow forch push without lease #87

Open
@lawvs

Description

@lawvs

📝 Brief description

By default, the force parameter is not a true --force but --force-with-lease. It will cause a push to fail when attempting to overwrite a remote branch.

This situation is likely to occur when used together with action-pull-request.

[INFO] Force pushing changes
To https://github.com/toeverything/xxx
 ! [rejected]        bot/sync -> bot/sync (stale info)
error: failed to push some refs to 'https://github.com/toeverything/xxx'
      - uses: devops-infra/action-commit-push@master
        with:
          github_token: "${{ secrets.GITHUB_TOKEN }}"
          commit_prefix: "[AUTO]"
          commit_message: "Sync"
          force: true
          target_branch: bot/sync

      - uses: devops-infra/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          title: "[AUTO] Update"
          target_branch: main

--force-with-lease alone, without specifying the details, will protect all remote refs that are going to be updated by requiring their current value to be the same as the remote-tracking branch we have for them.
https://git-scm.com/docs/git-push#:~:text=is%20still%20valid.-,%2D%2Dforce%2Dwith%2Dlease,-alone%2C%20without%20specifying

⚠️ Checklist

  • Provided a clear and concise description of what the issue is.
  • Given a clear and concise description of what is expected.
  • Proposed a clear and concise description of any alternative solutions or other features.
  • Added any other context or screenshots about the feature request.
  • Associated pull request has been already created and link was provided.

Check CONTRIBUTING.md and CODE_OF_CONDUCT.md for more information

Metadata

Metadata

Labels

featureAdding a new feature

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions