docker-node
docker-node copied to clipboard
chore: Allow auto-pr to include multiple changes
Opened this as a draft since I noticed the auto-pr is creating a single commit and force pushing while the upstream PR is open. I haven't tested this, so I'm opening as a draft for discussion. The idea would be to manually create the commits as described https://github.com/peter-evans/create-pull-request#controlling-commits and then just the let the action update/push the branch
/cc @ttshivers
I like this. What is the || true
for?
In the case of nothing to commit, git commit -am
will exit non-zero and fail the job.
$ git commit -am "foo"
On branch allow-multiple-auto-pr-changes
Your branch is up to date with 'origin/allow-multiple-auto-pr-changes'.
nothing to commit, working tree clean
Other minor thoughts on this one:
- Possibly keep title generic
- Append comments/body when updating existing PR
Those might be more hassle than benefit to add
What if instead of ... || true
, it was something like git diff-index --quiet HEAD || git commit ...
, so that real errors do cause a fail.
Source: https://stackoverflow.com/a/8123841
Other minor thoughts on this one:
- Possibly keep title generic
- Append comments/body when updating existing PR
Those might be more hassle than benefit to add
For updating PR body, let me see if there is a good way to find the associated PR.
Edit: One way is just using the output of the PR action and editing it afterwards.
Thanks! that is a better idea
@ttshivers yeah, that's why I was thinking it might be more trouble that it's worth, since github already has the relationship from the comment on the closed PR in this repo. Alternately, that part could just be removed from the PR body in official images, but doesn't really matter
Ah, there is an issue with this atm. The node
ref is on the fork, not on the main repo. The PR action uses the repo checked out as the place it makes its PR. If the forked repo was checked out, it wouldn't make the PR to the official one.
Looking at the docs (https://github.com/peter-evans/create-pull-request), I think a strategy like this might work:
- Check out official repo still
-
git remote add fork https://github.com/nodejs-github-bot/official-images
-
git fetch fork
-
git checkout -b node --track fork/node
Then in the action, specify base: master
to make it open the PR against that branch on the official-images repo
I think you might need to add base: master
in the action config, otherwise I think it will try and open a PR to a branch named node
since that is what is checked out. https://github.com/peter-evans/create-pull-request#action-inputs
base | Sets the pull request base branch. | Defaults to the branch checked out in the workflow. |
---|
Also, running some tests for this action (with it pointing to different repos). I notice that it may be required to do:
git config user.email "[email protected]"
git config user.name "Your Name"
instead of just doing it inline in the commit.
See: https://github.com/ttshivers/docker-node/runs/1245462778?check_suite_focus=true#step:6:1
Using the node
branch that is tracked by the fork is not working with this PR action. I've opened an issue on the PR to see if there can be an easy workaround made: https://github.com/peter-evans/create-pull-request/issues/609
However, we might just need to write our own logic to create / update the PR instead.