-
-
Notifications
You must be signed in to change notification settings - Fork 439
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
Is it possible to fully restore all git state after the action? #2547
Comments
Hi @glasser Thank you for reporting this issue. I added the I don't really want to add additional options to the action, unless it's unavoidable. I've made an effort to keep the interface simple and not bloated with config options. So I think reverting all state in every case is simple and intuitive. I'll take a look at this change when I get a chance. It would require a major version bump, though, because potentially it would be a breaking change for some workflows that expect a particular git state after the action completes. |
I would certainly be happy if v6 let me do the thing I wanted with zero extra configuration :) |
I remember now why the non-config git state works this way. One of the features of this action is that you can make your own commits which get included in the PR. I think it's a bit too complicated (and probably undesirable) to try and restore those commits after the action completes, so I decided to just let the git state reflect anything that wasn't committed by I think I would prefer to leave it the way it is for now. I might change my mind in future. There is a pretty straightforward workaround, as an alternative to the one you are already doing. Just run the |
Makes sense. The downside to parallelizing is that constructing the file changes can be slow, so ideally that is shared across jobs. Though GH Actions does provide various ways to share state across jobs... |
Closing for now. |
Subject of the issue
I'm looking to use this action multiple times in a workflow to create a bunch of PRs for different parts of one change. That is, my workflow will run a command that changes a bunch of files, and then use this action multiple times with
add-paths
(and explicitbranch
) to create a few different PRs so that different people can apply the change to different parts of the tree.This actually works really well, as long as the paths are all fully disjoint: the workflow will commit the specified files to the temporary branch, stash the other files, make the PR, and restore the stashed files.
However, in some cases I might want the add-paths to overlap. eg, maybe I will make one PR that's "merge all of the changes to the whole repo as one PR", a set of PRs that are per top-level directory, and a set of PRs that are per second-level directory. Depending on the level of granularity and care that is required, you can merge any set of PRs; when the workflow runs again it will helpfully close any other PRs that are now redundant.
The overall
create-pull-request
model supports this, but because the changes inadd-paths
paths vanish after a call tocreate-pull-request
, I can't create these overlapping PRs in a simple way.As a workaround, I can run
git stash
after setting up my file state, and then before each call to this action I can rungit restore --source=stash@{0} -- FILES FOR THIS PR
, and then not useadd-paths
. But it would be nice if the action just had a flag that essentially made it do this for me.If nothing else, I'm not sure that the docs actually explain anywhere that the effect on your local git state is that you will end up back with the same branch checked out with the same commit as before you ran it, with the files matched by
add-paths
reset to their state from the commit, and all other local changes preserved. It's sort of implied by theadd-paths
documentation, but not explicitly.Steps to reproduce
Run this workflow:
You'll end up with PRs for the individual files but no PR for "all".
The text was updated successfully, but these errors were encountered: