diff --git a/website/api/controllers/webhooks/receive-from-github.js b/website/api/controllers/webhooks/receive-from-github.js index 52c26ea949..fd7c1f9bac 100644 --- a/website/api/controllers/webhooks/receive-from-github.js +++ b/website/api/controllers/webhooks/receive-from-github.js @@ -24,6 +24,8 @@ module.exports = { let GitHub = require('machinepack-github'); + let IS_FROZEN = true;// « Set this to `true` whenever a freeze is in effect, then set it back to `false` when the freeze ends. + let GREEN_LABEL_COLOR = 'C2E0C6';// « Used in multiple places below. let GITHUB_USERNAMES_OF_BOTS_AND_MAINTAINERS = [// « Used in multiple places below. 'sailsbot', @@ -276,6 +278,12 @@ module.exports = { await sails.helpers.http.post(`https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}/reviews`, { event: 'APPROVE' }, baseHeaders); + } else if (IS_FROZEN) { + // [?] https://docs.github.com/en/rest/reference/pulls#create-a-review-for-a-pull-request + await sails.helpers.http.post(`https://api.github.com/repos/${owner}/${repo}/pulls/${prNumber}/reviews`, { + event: 'REQUEST_CHANGES', + body: 'The repository is currently frozen for an upcoming release. Please do not merge this change yet. After the freeze has ended, please come back, edit your PR description, hit the spacebar a few times to make an arbitrary change, then save your PR. You will then be able to merge your change! In case of emergency, you can dismiss this review.' + }, baseHeaders); } // And also unfreeze and re-freeze to temporarily allow merging.