conda-forge / conda-forge-webservices

the heroku app deployed to run conda-forge admin commands and linting
BSD 3-Clause "New" or "Revised" License
8 stars 35 forks source link

Bot re-rendering pushes empty commit (related to GHA automerge changes) #706

Open jakirkham opened 5 months ago

jakirkham commented 5 months ago

Asked the bot to re-render in this PR comment: https://github.com/conda-forge/cuda-nvtx-feedstock/pull/13#issuecomment-2111168500

Instead of pushing changes or noting that no changes could be made, it pushed an empty commit: https://github.com/conda-forge/cuda-nvtx-feedstock/pull/13/commits/0228ab7defdcbf4f9f4d4331ce458ee024d3eb1b

Looking at the bot's logs in more detail ( https://github.com/conda-forge/cuda-nvtx-feedstock/pull/13#issuecomment-2111171831 ), it appears to have tried to make some kind of change in an initial commit. However it then made a follow up commit, which was pushed. That follow up commit was empty

When trying locally ( https://github.com/conda-forge/cuda-nvtx-feedstock/pull/13#issuecomment-2111184069 ), it appears that conda-smithy is updating the GHA automerge workflow. This works ok locally

Not sure why the bot loses these changes and pushes an empty commit instead

beckermr commented 5 months ago

This all appears correct. The token used when rerendering cannot push changes to GitHub workflows. The rerender job runs smithy. Then it checks if any changes to the workflows have been made. If there are changes to the workflows, it reverts them for just those files. Then the rerender job pushes a commit.

So in this case, since this pr was made before we migrated the workflows, the files on the pr branch are behind. Thus even if the rerender produces those changes, they won't get pushed because our infrastructure can't.

jakirkham commented 5 months ago

Instead of pushing an empty commit, could the bot leave a comment to tell the user that they might need to do something?

beckermr commented 5 months ago

The empty commit is just because there were not any other changes in the rerender. Usually there are other changes and so the commit is not empty.

Anyone should feel free to add code to detect if the commit will be empty and to warn instead of pushing. One should also add code to warn folks that changes were backed out and that they should rerender and push by hand or try to merge upstream into their branch.