You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/10/26 13:46:14 UTC
[GitHub] [beam] damccorm opened a new issue, #23851: [Task]: PR Bot - Only push commit if non-empty
damccorm opened a new issue, #23851:
URL: https://github.com/apache/beam/issues/23851
### What needs to happen?
Right now, we push a number of non-empty commits for our PR bot - https://github.com/apache/beam/blob/ead2d2e8025874ad5c3f09ea0fda06caf027e18c/scripts/ci/pr-bot/shared/persistentState.ts#L43 - we can be a little smarter about this and only push commits if they are meaningful.
### Issue Priority
Priority: 3
### Issue Component
Component: infrastructure
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] damccorm commented on issue #23851: [Task]: PR Bot - Only push commit if non-empty
Posted by GitBox <gi...@apache.org>.
damccorm commented on issue #23851:
URL: https://github.com/apache/beam/issues/23851#issuecomment-1292443349
Hey @ayushthe1 - right now, our PR bot (which is backed by GitHub Actions) stores its state, it checks it in as a file to the branch `pr-bot-state` (this is done here - https://github.com/apache/beam/blob/ead2d2e8025874ad5c3f09ea0fda06caf027e18c/scripts/ci/pr-bot/shared/persistentState.ts#L43). Right now, we will produce a commit any time we call save state, even if there are no changes to commit.
The goal of this issue is to check if there have been any changes before producing a commit. One way to do this would be running something like `git diff-index --quiet HEAD` before adding the files to be committed; this should produce output only if there are changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] damccorm commented on issue #23851: [Task]: PR Bot - Only push commit if non-empty
Posted by GitBox <gi...@apache.org>.
damccorm commented on issue #23851:
URL: https://github.com/apache/beam/issues/23851#issuecomment-1297082476
A slightly cleaner approach than inspecting the output is probably to use the `quiet` flag and then inspect the exit code. There are usually tighter guarantees around exit codes than outputs. If there are changes, `git diff-index --quiet HEAD` will have an exit code of 1, if not it will have an exit code of 0.
So if you do, for example, `git diff-index --quiet HEAD || (git add * && git commit -m "Message" && git push)`, the `add`, `commit`, and `push` steps will only run if there are changes. Alternatively, you can use the exec client we are already using to inspect the exit code of the command and then move the if/else logic into the javascript
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] ayushthe1 commented on issue #23851: [Task]: PR Bot - Only push commit if non-empty
Posted by GitBox <gi...@apache.org>.
ayushthe1 commented on issue #23851:
URL: https://github.com/apache/beam/issues/23851#issuecomment-1293219291
hey @damccorm i am running into some issues . I used `git diff-index HEAD` and saw it produces some output if there are any changes made in repo .It also don't produces any output if no changes are made or if the last commit was an empty commit.
However on using the `--quiet` flag ,no output is produced in both cases . So how can i use this command with `--quiet` flag if no output is produced whether or not any changes are made in repo.
My idea initially was to use some kind of `if-else` statement on condition if `git diff-index --quiet HEAD` produces any output or not and then putting the current `git add ,commit ,push` under it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] damccorm commented on issue #23851: [Task]: PR Bot - Only push commit if non-empty
Posted by GitBox <gi...@apache.org>.
damccorm commented on issue #23851:
URL: https://github.com/apache/beam/issues/23851#issuecomment-1292443854
I assigned you as well. For future reference, you can self-assign issues by commenting `.take-issue`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] ayushthe1 commented on issue #23851: [Task]: PR Bot - Only push commit if non-empty
Posted by GitBox <gi...@apache.org>.
ayushthe1 commented on issue #23851:
URL: https://github.com/apache/beam/issues/23851#issuecomment-1292457480
> I assigned you as well. For future reference, you can self-assign issues by commenting `.take-issue`
Thanks ! I will look into all the details you provided. :smile:
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] ayushthe1 commented on issue #23851: [Task]: PR Bot - Only push commit if non-empty
Posted by GitBox <gi...@apache.org>.
ayushthe1 commented on issue #23851:
URL: https://github.com/apache/beam/issues/23851#issuecomment-1292432994
hey @damccorm ,i would like to work on this issue. Please assign it to me.
Also could you please elaborate what i need to do .
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] ayushthe1 commented on issue #23851: [Task]: PR Bot - Only push commit if non-empty
Posted by GitBox <gi...@apache.org>.
ayushthe1 commented on issue #23851:
URL: https://github.com/apache/beam/issues/23851#issuecomment-1300408075
Thanks @damccorm for your help. :smile:
I think your method is more simpler and cleaner ,so i will go with it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [beam] damccorm closed issue #23851: [Task]: PR Bot - Only push commit if non-empty
Posted by GitBox <gi...@apache.org>.
damccorm closed issue #23851: [Task]: PR Bot - Only push commit if non-empty
URL: https://github.com/apache/beam/issues/23851
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org