create-pull-request: Can't push pull request branch

Subject of the issue

Getting error Pushing pull request branch to 'origin/promote' after upgrade v3

 /usr/bin/git push --force-with-lease origin HEAD:refs/heads/promote
  To https://github.com/<retacted>
   ! [rejected]          HEAD -> promote (stale info)
  error: failed to push some refs to 'https://github.com/<retacted>'
  Error: The process '/usr/bin/git' failed with exit code 1

Steps to reproduce

Not sure if it’s reproducible outside of our repo. We’re using the on schedule action to create image promotion PR’s. We only upgraded v3 because of the The set-env command is disabled. warnings.

Possibly, create a new branch not exist remotely could reproduces the error.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

@aweris @fglaeser I have a workaround until I can fix the action. Add the following line to your workflow after the checkout step.

    steps:
      - uses: actions/checkout@v2

+     - run: git remote prune origin

      # Make changes to pull request here

      - name: Create Pull Request
        uses: peter-evans/create-pull-request@v3

@sarathnairck12,

This error is related to a recent security update in runners. The command basically disabled. You can try to upgrade v3 since the new version is written in Typescript. It’s not using set-env anymore.

Blog: https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/