Skip to content

Check for non-blocked status when determining isMergeable - #6998

Merged
roryabraham merged 8 commits into
mainfrom
andrew-mergeable
Jan 4, 2022
Merged

Check for non-blocked status when determining isMergeable#6998
roryabraham merged 8 commits into
mainfrom
andrew-mergeable

Conversation

@AndrewGable

@AndrewGable AndrewGable commented Jan 4, 2022

Copy link
Copy Markdown
Contributor

Details

Adds a check for the mergeable_state of a PR to make sure it is not BLOCKED. This is the state that a PR can get in with unverified commits, messing up the deploy process.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/190589

Tests

  1. I verified that PRs that are not able to be auto-merged if they are not in the mergeable_state of "clean", "has_hooks", "unknown", "unstable", so this will prevent auto-merge from silently failing in the BLOCKED state

QA Steps

N/A

@AndrewGable AndrewGable self-assigned this Jan 4, 2022
@AndrewGable AndrewGable changed the title Check for clean status when determining isMergeable Check for non-blocked status when determining isMergeable Jan 4, 2022
@AndrewGable
AndrewGable marked this pull request as ready for review January 4, 2022 18:53
@AndrewGable
AndrewGable requested a review from a team as a code owner January 4, 2022 18:53
@MelvinBot
MelvinBot requested review from jasperhuangg and removed request for a team January 4, 2022 18:53
@AndrewGable
AndrewGable removed the request for review from jasperhuangg January 4, 2022 19:51
mergeabilityResolved = true;
isMergeable = data.mergeable;
console.log(`Merge information for #${pullRequestNumber} - mergeable: ${data.mergeable}, mergeable_state ${data.mergeable_state}`);
isMergeable = data.mergeable && data.mergeable_state !== 'BLOCKED';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like in the images the value is lowercase, should we uppercase the data.mergeable_state value to ensure the comparison is exact?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated with @roryabraham's suggestion which should handle this

Comment thread .github/actions/isPullRequestMergeable/index.js Outdated
roryabraham
roryabraham previously approved these changes Jan 4, 2022
Comment thread .github/actions/isPullRequestMergeable/isPullRequestMergeable.js Outdated
Comment thread .github/actions/isPullRequestMergeable/isPullRequestMergeable.js Outdated
Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com>
AndrewGable and others added 3 commits January 4, 2022 15:07
Co-authored-by: Rory Abraham <47436092+roryabraham@users.noreply.github.com>

@roryabraham roryabraham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good, but I think we might need to update the unit tests now

@AndrewGable

Copy link
Copy Markdown
Contributor Author

Sorry looks like a jest test failed, looking into it now.

@AndrewGable

Copy link
Copy Markdown
Contributor Author

Jest tests should be passing now, just waiting on E2E for the ✅

@roryabraham
roryabraham merged commit 9f3dc92 into main Jan 4, 2022
@roryabraham
roryabraham deleted the andrew-mergeable branch January 4, 2022 23:05
@OSBotify

OSBotify commented Jan 4, 2022

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

OSBotify commented Jan 6, 2022

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by @roryabraham in version: 1.1.25-2 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by @Jag96 in version: 1.1.26-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants