feat: make CI workflows run on the exact PR branch#114
feat: make CI workflows run on the exact PR branch#114davidbtadokoro wants to merge 1 commit intokworkflow:unstablefrom
Conversation
The project's CI relies heavily on the `checkout` action from GitHub Actions that, essentially, deals with checking out to the correct commit on which to run the workflow. By default, PRs check out to the temporary merge commit resulting from the PR branch HEAD and the target branch HEAD (`unstable` here in `patch-hub`). This logic is sound to "assure" that the workflows run on a version of the PR that considers the latest state of the branch it intends to merge. However, it can cause strange side effects, such as when GitHub can successfully merge, but the PR branch conflicts in other ways. In this example [1][2], the PR kworkflow#100 changed the function `install_hooks()` to expect an argument, but in `unstable`, there was a commit that introduced a test that used `install_hooks()` without arguments. The merge was done seamlessly, but it generated a compilation error. In this sense, change the workflows to check out to PR branch HEAD commit instead of merge commit [3] to avoid us guessing what happened when debugging failing workflows. This has the upside down of "wasting" CI on "stale" PR branches, but demanding updated branches is a maintainer's job (besides being a good practice from contributors). [1]: https://github.com/kworkflow/patch-hub/actions/runs/13722146202/job/38391557671 [2]: https://github.com/kworkflow/patch-hub/actions/runs/13722146239/job/38379854217 [3]: https://github.com/actions/checkout/blob/main/README.md#Checkout-pull-request-HEAD-commit-instead-of-merge-commit Signed-off-by: David Tadokoro <davidbtadokoro@usp.br>
|
@OJarrisonn, this PR addresses the problem we talked about offline, where the CI job was failing due to unexistent code. I've run multiple tests, and I am confident that this solves the issue, i.e., PR workflows will be run using the exact PR branch whilst not messing with direct pushes to target branches. Could you please review this PR (and leave your |
|
Sorry for the wait On my end it seems to be alright, but I don't know much about github CI I agree with the changes, how do i leave my |
No worries! You didn't made me wait 😸
No problems. I did some heavy testing and study of this to make sure I wasn't mistaken. I wanted your input as I value your perception, so if you think nothing stands out, I am pleased.
Usually you write it in the response (here in GitHub, as a comment) with a line like Reviewed-by: David Tadokoro davidbtadokoro@usp.br if you consider that the change is good to go (or with minimal adjustments). As I can fetch your |
The project's CI relies heavily on the
checkoutaction from GitHub Actions that, essentially, deals with checking out to the correct commit on which to run the workflow. By default, PRs check out to the temporary merge commit resulting from the PR branch HEAD and the target branch HEAD (unstablehere inpatch-hub). This logic is sound to "assure" that the workflows run on a version of the PR that considers the latest state of the branch it intends to merge.However, it can cause strange side effects, such as when GitHub can successfully merge, but the PR branch conflicts in other ways. In this example 1, the PR #100 changed the function
install_hooks()to expect an argument, but inunstable, there was a commit that introduced a test that usedinstall_hooks()without arguments. The merge was done seamlessly, but it generated a compilation error.In this sense, change the workflows to check out to PR branch HEAD commit instead of merge commit 3 to avoid us guessing what happened when debugging failing workflows. This has the upside down of "wasting" CI on "stale" PR branches, but demanding updated branches is a maintainer's job (besides being a good practice from contributors).