mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
GitHub webhook: Only unfreeze/refreeze if actually frozen. (#5182)
Complements https://github.com/fleetdm/fleet/pull/5181 Related to https://github.com/fleetdm/fleet/issues/5179
This commit is contained in:
parent
69f8f7da8f
commit
7bc16c9b36
@ -278,18 +278,22 @@ module.exports = {
|
||||
// And also unfreeze and re-freeze to temporarily allow merging.
|
||||
// [?] https://github.com/fleetdm/fleet/issues/5179
|
||||
if (isAutoApproved) {
|
||||
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);//_∏_
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user