Skip to content

Avoid preventing merging of markdown-only PRs during release freeze #5179

@mikermcneil

Description

@mikermcneil

🧑‍💻  Expected behavior

As a contributor, I want to merge a PR to markdown files during the freeze.

💥  Actual behavior

I can't.

Analysis

So: It is not possible, unfortunately, to unfreeze a particular PR after all using MergeFreeze's API.

i.e. this 404s

await sails.helpers.http.post('https://www.mergefreeze.com/api/branches/fleetdm/fleet/desmi-dizney-patch-9?access_token=TOKEN_HERE', {  frozen: true, user_name: 'mikermcneil' })

Because only protected branches are supported as the "branch" . i.e. only main . Which doesn't do us much good.

So there are three ways forward as I see it:

  1. Replace MergeFreeze with our own custom checker
  2. A total hack that temporarily unfreezes the whole repo whenever a markdown-only PR is submitted, than re-freezes it again like 2m later, giving you a brief chance to merge. Non-ideal, because it means that during those 2m all PRs are unfrozen.
  3. Use the GitHub API to manually override the status check for a PR (tbd whether this actually works)

I think (3) could be the right approach if it's actually possible to override MergeFreeze's status. This looks promising, maybe (although it would take additional steps to figure out the right ID to use, and it's unclear whether it would actually work.

So in the meantime, I'm going to implement the quick hack (2) so that this is resolved for the next freeze.

EDIT: Here is the quick hack:

// And also unfreeze and re-freeze to temporarily allow merging.
// [?] https://github.com/fleetdm/fleet/issues/5179
// // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// > Temporarily disable re-freeze logic to troubleshoot website caching issues on 2022-05-03.
// > (very unlikely this is a culprit, but ruling out race conditions)
// > ~mikermcneil
// // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// if (isAutoApproved) {
//
// let mergeFreezeReport = await sails.helpers.http.get('https://www.mergefreeze.com/api/branches/fleetdm/fleet/main', { access_token: sails.config.custom.mergeFreezeAccessToken });//eslint-disable-line camelcase
// if (mergeFreezeReport.frozen) {
// await sails.helpers.http.post('https://www.mergefreeze.com/api/branches/fleetdm/fleet/main', { frozen: false, access_token: sails.config.custom.mergeFreezeAccessToken, user_name: 'fleet-release' });//eslint-disable-line camelcase
//
// // Then, in the background, 2 minutes later...
// setTimeout(()=>{
// sails.helpers.http.post('https://www.mergefreeze.com/api/branches/fleetdm/fleet/main', { frozen: true, access_token: sails.config.custom.mergeFreezeAccessToken, user_name: 'fleet-release' })//eslint-disable-line camelcase
// .exec((err)=>{
// if (err) {
// sails.log.error('Background instruction failed: Unexpected error re-freezing repo (see https://github.com/fleetdm/fleet/issues/5179 for background):', err);
// }
// sails.log.info('Re-freeze completed successfully.');
// });//_∏_
// }, 2*60*1000);//_∏_
// }//fi
//
// }//fi
// // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Longer term solution: Before messing with (3) above, it would make sense to reach out to MergeFreeze, or at least consider an alternative.

I have not reached out to MergeFreeze. If we like their product, then one approach could be to ask them for the ability to unfreeze a particular PR in the API. (It clearly exists in the product, since you can press a button, just isn't documented)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions