balena-io / deploy-to-balena-action

Official Github action to deploy releases to balenaCloud environments
Apache License 2.0
38 stars 13 forks source link

Add option to always build on PR merge #272

Closed treygilliland closed 11 months ago

treygilliland commented 1 year ago

An issue I continue to run into is the following:

  1. Open PR#1 and create draft release
  2. Open PR#2 and create draft release
  3. Merge PR#1 which finalizes its draft release
  4. Merge PR#2 which finalizes its draft release

This leaves the build from PR#2 without the code changes merged in PR#1 which has caused inconsistencies in our deployment process.

The desired functionality would be to detect that the main branch has changed and rebuild the build for PR#2. Not sure how complex that would be to implement so adding a flag to always rebuild on merge could also work

klutchell commented 11 months ago

Have you tried using the branch protection rule Require branches to be up to date before merging?

We use this on all our repos internally to ensure that a PR cannot merge unless it has been rebased on the latest from the BASE branch.

That way nothing can merge without testing the merged code. In your example PR#2 hasn't really been tested properly because it did not include PR#1 changes.

We have found that avoiding excessive workflows that could fail AFTER merging is not desirable, and it is preferable to perform most of the rebasing and retesting upfront while the PR is still unmerged.

treygilliland commented 11 months ago

Yes, I did find this setting and start using it on the repo. Has been working well for us so will close.