Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable force pushes into PR branch #664

Closed
onedr0p opened this issue Dec 17, 2020 · 4 comments
Closed

Disable force pushes into PR branch #664

onedr0p opened this issue Dec 17, 2020 · 4 comments

Comments

@onedr0p
Copy link

onedr0p commented Dec 17, 2020

Subject of the issue

I have a schedule set up to open a PR when it notices a new version of Flux2

image

I notice that it keeps force pushing master into this branch when changes are made in master, is there anyway to disable this behavior?

Steps to reproduce

  • Create schedule that opens a PR into main branch
  • Let action open PR
  • Commit to main branch
  • Next schedule run see that the PR is updated and the branch was force-pushed into
@peter-evans
Copy link
Owner

Hi @onedr0p

This is fundamental to how the action is designed to work and there is no option to disable it at the moment. It makes sure pull request branches up-to-date every time the action is run. For example, if the commit from the pull request was cherry-picked to the base branch then the next run of the action would detect that there is no more diff and close the pull request.

Is there a reason you don't want it to update?

If you really don't want it to update then what that effectively means is that you don't want the action to run. So one option you could try is adding a step to detect if the pull request branch exists and exit the workflow if it does.

@onedr0p
Copy link
Author

onedr0p commented Dec 18, 2020

Is there a reason you don't want it to update?

The files that are being modified in my workflow are files that would never be changed by a human, so there's no issue of a merge conflict happening. Having the PR be up-to-date isn't really needed and I get spammed with Github notifications everytime it happens.

So one option you could try is adding a step to detect if the pull request branch exists and exit the workflow if it does.

This is good work-around and will implement it, but would be awesome if it was built into the action as well.

Thanks!

@onedr0p
Copy link
Author

onedr0p commented Dec 18, 2020

It appears as though github actions doesn't have a way to gracefully exit a workflow based on a condition or not, so the only way for that work-around is have the workflow fail when the branch exists which is not ideal.

https://stackoverflow.com/questions/57903836/how-to-fail-a-job-in-github-actions
actions/runner#662

@peter-evans
Copy link
Owner

It appears as though github actions doesn't have a way to gracefully exit a workflow based on a condition or not

Fairly sure you can just skip steps that you don't want to run without it failing the workflow.

Closing this issue, but feel free to continue the conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants