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

Empty commits on open PR #549

Open
nagano opened this issue Sep 4, 2023 · 5 comments
Open

Empty commits on open PR #549

nagano opened this issue Sep 4, 2023 · 5 comments

Comments

@nagano
Copy link

nagano commented Sep 4, 2023

After opening a PR with the changes, if I run the action again it pushes an empty commit to the branch.
Is there any way to avoid this?

I have a workflow that runs a couple times a week and the PR can remain open for a while, and I'd like to avoid the noise.

@fjogeleit
Copy link
Owner

Your first run creates a branch and opens a PR, the second run pushes an empty commit to the already created branch?

@nagano
Copy link
Author

nagano commented Sep 4, 2023

Correct. After the first run, it pushes a commit with no content on the next runs

@fjogeleit
Copy link
Owner

fjogeleit commented Sep 4, 2023

The action would stop if the content would not change but in your case its not possible.

If you create branches for your changes, you could check in a step before if a branch already exists and stop if so.

git ls-remote --exit-code --heads origin <branch-name>

@nagano
Copy link
Author

nagano commented Sep 4, 2023

Is the problem related to creating a branch + pushing the changes?

In my case, there could be changes between the first run (create branch + open PR) and the next time it runs the action, since the YAML values are based on a separate config file. So I need to run the action every time to check for new changes, I can't stop the whole thing based on the existence of the branch.

Also, forgot to mention, but my workflow is targeting a different target repo

@fjogeleit
Copy link
Owner

Hmm okay, I can check if I find a possible check to avoid it but not sure if I can do much against it.

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