github / branch-deploy

Enabling Branch Deployments through IssueOps with GitHub Actions - If you find this project useful, give it a star! ⭐️
https://github.com/marketplace/actions/branch-deploy
MIT License
364 stars 44 forks source link

Rollback uses merge commit instead of commit from PR #287

Closed mailaneel closed 1 month ago

mailaneel commented 1 month ago

Describe the Issue

outputs.sha refers to merge commit when rolling back to default branch instead of its parent commit

https://github.com/github/branch-deploy/blob/91f77d0f24b03ff5f3d0fd24ce45498d1690d16b/src/functions/prechecks.js#L65

This is fixed here: https://github.com/github/branch-deploy/blob/91f77d0f24b03ff5f3d0fd24ce45498d1690d16b/src/functions/identical-commit-check.js#L55

How are we trying to use this? We create docker tag on parent commit rather than merge commit sha and when trying to rollback we cannot find the docker image because outputs.sha refers to merge commit

Also please suggest if there is alternative way to resolve this.

Action Configuration

No response

Relevant Actions Log Output

No response

Extra Information

No response

GrantBirki commented 1 month ago

👋 Hey @mailaneel! Thanks for opening this issue.

I think I could see value in adding another output that specifically refers to the parent commit instead of the merge commit for this use case.

So perhaps we have two outputs like so:

Let me know your thoughts!

P.S. also let me know your thoughts if we should just outright switch outputs.sha from being the merge commit to the parent commit and if so, why.

Thanks! 🙇

mailaneel commented 1 month ago

parent_sha makes sense, and it also helps with backwards compatibility

GrantBirki commented 1 month ago

@mailaneel I'm working on a PR for this now. I'm opting to just use default_branch_tree_sha as the name of the new Actions output because I'm honestly not sure if it will reflect the parent sha in all contexts so its probably best to just leave the name as exactly what it is.

GrantBirki commented 1 month ago

Changes are in v9.5.0 🎉