From 627681c82ae46df07e0e8d10faf02df4d2183b6b Mon Sep 17 00:00:00 2001 From: Sergei Zharinov Date: Fri, 29 Oct 2021 20:37:05 +0300 Subject: [PATCH] feat(github): Detect GitHub automerge setting (#12398) --- .../github/__snapshots__/index.spec.ts.snap | 213 ++++++++++++------ lib/platform/github/graphql.ts | 1 + lib/platform/github/index.spec.ts | 118 ++-------- lib/platform/github/index.ts | 52 ++--- lib/platform/github/types.ts | 2 + 5 files changed, 184 insertions(+), 202 deletions(-) diff --git a/lib/platform/github/__snapshots__/index.spec.ts.snap b/lib/platform/github/__snapshots__/index.spec.ts.snap index f5bfa16060db20..d8291824b1bc11 100644 --- a/lib/platform/github/__snapshots__/index.spec.ts.snap +++ b/lib/platform/github/__snapshots__/index.spec.ts.snap @@ -14,6 +14,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -37,7 +38,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -81,6 +82,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -104,7 +106,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -165,6 +167,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -188,7 +191,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -247,6 +250,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -270,7 +274,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -346,6 +350,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -369,7 +374,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -414,6 +419,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -437,7 +443,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -473,6 +479,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -496,7 +503,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -619,6 +626,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -642,7 +650,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -765,6 +773,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -788,7 +797,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -900,6 +909,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -923,7 +933,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -1027,6 +1037,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -1050,7 +1061,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -1154,6 +1165,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -1177,7 +1189,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -1292,6 +1304,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -1315,7 +1328,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -1430,6 +1443,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -1453,7 +1467,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -1548,6 +1562,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -1571,7 +1586,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -1673,6 +1688,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -1696,7 +1712,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -1791,6 +1807,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -1814,7 +1831,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -1927,6 +1944,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -1950,7 +1968,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -2055,6 +2073,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -2078,7 +2097,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -2189,6 +2208,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -2212,7 +2232,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -2296,6 +2316,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -2319,7 +2340,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -2414,6 +2435,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -2437,7 +2459,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -2532,6 +2554,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -2555,7 +2578,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -2668,6 +2691,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -2691,7 +2715,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -3037,6 +3061,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -3060,7 +3085,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -3112,6 +3137,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -3135,7 +3161,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -3171,6 +3197,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -3194,7 +3221,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -3246,6 +3273,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -3269,7 +3297,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -3362,6 +3390,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -3385,7 +3414,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -3645,6 +3674,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -3668,7 +3698,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -3728,6 +3758,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -3751,7 +3782,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4002,6 +4033,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4025,7 +4057,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4291,6 +4323,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4314,7 +4347,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4361,6 +4394,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4384,7 +4418,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4409,6 +4443,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4432,7 +4467,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4479,6 +4514,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4502,7 +4538,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4549,6 +4585,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4572,7 +4609,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4619,6 +4656,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4642,7 +4680,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4689,6 +4727,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4712,7 +4751,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4759,6 +4798,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4782,7 +4822,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4818,6 +4858,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4841,7 +4882,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4877,6 +4918,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4900,7 +4942,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4936,6 +4978,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -4959,7 +5002,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -4995,6 +5038,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -5018,7 +5062,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -5077,6 +5121,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -5100,7 +5145,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -5321,6 +5366,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -5344,7 +5390,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -5494,6 +5540,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -5517,7 +5564,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -5751,6 +5798,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -5774,7 +5822,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -6006,6 +6054,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -6029,7 +6078,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -6245,6 +6294,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -6268,7 +6318,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7012,6 +7062,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7035,7 +7086,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7140,6 +7191,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7163,7 +7215,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7217,6 +7269,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7240,7 +7293,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7272,6 +7325,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7295,7 +7349,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7327,6 +7381,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7350,7 +7405,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7382,6 +7437,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7405,7 +7461,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7430,6 +7486,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7453,7 +7510,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7478,6 +7535,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7501,7 +7559,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7533,6 +7591,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7556,7 +7615,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7620,6 +7679,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7643,7 +7703,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7690,6 +7750,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7713,7 +7774,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "github.company.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7740,6 +7801,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7763,7 +7825,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7852,6 +7914,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7875,7 +7938,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -7948,6 +8011,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -7971,7 +8035,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -8012,6 +8076,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -8035,7 +8100,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -8076,6 +8141,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -8099,7 +8165,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -8140,6 +8206,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -8163,7 +8230,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -8204,6 +8271,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -8227,7 +8295,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -8263,6 +8331,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -8286,7 +8355,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -8363,6 +8432,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -8386,7 +8456,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", @@ -8429,6 +8499,7 @@ Array [ "name": "$name", "owner": "$owner", }, + "autoMergeAllowed": null, "defaultBranchRef": Object { "name": null, "target": Object { @@ -8452,7 +8523,7 @@ Array [ "accept": "application/vnd.github.v3+json", "accept-encoding": "gzip, deflate, br", "authorization": "token 123test", - "content-length": "351", + "content-length": "373", "content-type": "application/json", "host": "api.github.com", "user-agent": "RenovateBot/0.0.0-semantic-release (https://github.com/renovatebot/renovate)", diff --git a/lib/platform/github/graphql.ts b/lib/platform/github/graphql.ts index 62d281444c7109..5e12374e432e12 100644 --- a/lib/platform/github/graphql.ts +++ b/lib/platform/github/graphql.ts @@ -4,6 +4,7 @@ query($owner: String!, $name: String!) { isFork isArchived nameWithOwner + autoMergeAllowed mergeCommitAllowed rebaseMergeAllowed squashMergeAllowed diff --git a/lib/platform/github/index.spec.ts b/lib/platform/github/index.spec.ts index 31baa0d5ef4516..b988bd51f17950 100644 --- a/lib/platform/github/index.spec.ts +++ b/lib/platform/github/index.spec.ts @@ -6,8 +6,6 @@ import { REPOSITORY_RENAMED, } from '../../constants/error-messages'; import { BranchStatus, PrState, VulnerabilityAlert } from '../../types'; -import * as _repoCache from '../../util/cache/repository'; -import { Cache } from '../../util/cache/repository/types'; import * as _git from '../../util/git'; import type { CreatePRConfig, Platform } from '../types'; @@ -17,7 +15,6 @@ describe('platform/github/index', () => { let github: Platform; let hostRules: jest.Mocked; let git: jest.Mocked; - let repoCache: jest.Mocked; beforeEach(async () => { // reset module jest.resetModules(); @@ -36,8 +33,6 @@ describe('platform/github/index', () => { hostRules.find.mockReturnValue({ token: '123test', }); - jest.mock('../../util/cache/repository'); - repoCache = mocked(await import('../../util/cache/repository')); }); const graphqlOpenPullRequests = loadFixture('graphql/pullrequest-1.json'); @@ -155,13 +150,18 @@ describe('platform/github/index', () => { }); }); - function initRepoMock(scope: httpMock.Scope, repository: string): void { + function initRepoMock( + scope: httpMock.Scope, + repository: string, + other: any = {} + ): void { scope.post(`/graphql`).reply(200, { data: { repository: { isFork: false, isArchived: false, nameWithOwner: repository, + autoMergeAllowed: true, mergeCommitAllowed: true, rebaseMergeAllowed: true, squashMergeAllowed: true, @@ -171,6 +171,7 @@ describe('platform/github/index', () => { oid: '1234', }, }, + ...other, }, }, }); @@ -1907,9 +1908,9 @@ describe('platform/github/index', () => { platformOptions: { usePlatformAutomerge: true }, }; - const mockScope = async (): Promise => { + const mockScope = async (repoOpts: any = {}): Promise => { const scope = httpMock.scope(githubApiHost); - initRepoMock(scope, 'some/repo'); + initRepoMock(scope, 'some/repo', repoOpts); scope .post('/repos/some/repo/pulls') .reply(200, createdPrResp) @@ -1963,15 +1964,8 @@ describe('platform/github/index', () => { }, }; - let cache: Cache; - beforeEach(() => { - cache = {}; - repoCache.getCache.mockReturnValue(cache); - }); - - it('should set automatic merge', async () => { - const scope = await mockScope(); - scope.post('/graphql').reply(200, graphqlAutomergeResp); + it('should skip automerge if disabled in repo settings', async () => { + await mockScope({ autoMergeAllowed: false }); const pr = await github.createPr(prConfig); @@ -1980,111 +1974,47 @@ describe('platform/github/index', () => { graphqlGetRepo, restCreatePr, restAddLabels, - graphqlAutomerge, ]); }); - it('should stop trying after GraphQL error', async () => { + it('should set automatic merge', async () => { const scope = await mockScope(); - scope - .post('/graphql') - .reply(200, graphqlAutomergeErrorResp) - .post('/repos/some/repo/pulls') - .reply(200, createdPrResp) - .post('/repos/some/repo/issues/123/labels') - .reply(200, []); + scope.post('/graphql').reply(200, graphqlAutomergeResp); - await github.createPr(prConfig); - await github.createPr(prConfig); + const pr = await github.createPr(prConfig); + expect(pr).toMatchObject({ number: 123 }); expect(httpMock.getTrace()).toMatchObject([ graphqlGetRepo, restCreatePr, restAddLabels, graphqlAutomerge, - restCreatePr, - restAddLabels, ]); }); - it('should retry 24 hours after GraphQL error', async () => { + it('should handle GraphQL errors', async () => { const scope = await mockScope(); - scope - .post('/graphql') - .reply(200, graphqlAutomergeErrorResp) - .post('/repos/some/repo/pulls') - .reply(200, createdPrResp) - .post('/repos/some/repo/issues/123/labels') - .reply(200, []) - .post('/repos/some/repo/pulls') - .reply(200, createdPrResp) - .post('/repos/some/repo/issues/123/labels') - .reply(200, []) - .post('/graphql') - .reply(200, graphqlAutomergeResp); - - // Error occured - const t1 = DateTime.local().toMillis(); - await github.createPr(prConfig); - const t2 = DateTime.local().toMillis(); - - expect(cache.lastPlatformAutomergeFailure).toBeString(); - - let failedAt = DateTime.fromISO(cache.lastPlatformAutomergeFailure); - - expect(failedAt.toMillis()).toBeGreaterThanOrEqual(t1); - expect(failedAt.toMillis()).toBeLessThanOrEqual(t2); - - // Too early - failedAt = failedAt.minus({ hours: 12 }); - cache.lastPlatformAutomergeFailure = failedAt.toISO(); - await github.createPr(prConfig); - expect(cache.lastPlatformAutomergeFailure).toEqual(failedAt.toISO()); - - // Now should retry - failedAt = failedAt.minus({ hours: 12 }); - cache.lastPlatformAutomergeFailure = failedAt.toISO(); - await github.createPr(prConfig); - + scope.post('/graphql').reply(200, graphqlAutomergeErrorResp); + const pr = await github.createPr(prConfig); + expect(pr).toMatchObject({ number: 123 }); expect(httpMock.getTrace()).toMatchObject([ - // 1 graphqlGetRepo, restCreatePr, restAddLabels, - graphqlAutomerge, // error - // 2 - restCreatePr, - restAddLabels, - // 3 - restCreatePr, - restAddLabels, - graphqlAutomerge, // retry + graphqlAutomerge, ]); }); - it('should keep trying after HTTP error', async () => { + it('should handle REST API errors', async () => { const scope = await mockScope(); - scope - .post('/graphql') - .reply(500) - .post('/repos/some/repo/pulls') - .reply(200, createdPrResp) - .post('/repos/some/repo/issues/123/labels') - .reply(200, []) - .post('/graphql') - .reply(200, graphqlAutomergeResp); - - await github.createPr(prConfig); - await github.createPr(prConfig); - + scope.post('/graphql').reply(500); + const pr = await github.createPr(prConfig); + expect(pr).toMatchObject({ number: 123 }); expect(httpMock.getTrace()).toMatchObject([ graphqlGetRepo, restCreatePr, restAddLabels, graphqlAutomerge, - restCreatePr, - restAddLabels, - graphqlAutomerge, ]); }); }); diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index 461f2f17a227b8..1ac125cb37c5ce 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -19,7 +19,6 @@ import { import { logger } from '../../logger'; import { BranchStatus, PrState, VulnerabilityAlert } from '../../types'; import { ExternalHostError } from '../../types/errors/external-host-error'; -import { getCache } from '../../util/cache/repository'; import * as git from '../../util/git'; import * as hostRules from '../../util/host-rules'; import * as githubHttp from '../../util/http/github'; @@ -246,6 +245,7 @@ export async function initRepo({ // This happens if we don't have Administrator read access, it is not a critical error logger.debug('Could not find allowed merge methods for repo'); } + config.autoMergeAllowed = repo.autoMergeAllowed; } catch (err) /* istanbul ignore next */ { logger.debug({ err }, 'Caught initRepo error'); if ( @@ -1386,59 +1386,37 @@ async function tryPrAutomerge( prNumber: number, prNodeId: string, platformOptions: PlatformPrOptions -): Promise { +): Promise { if (!platformOptions?.usePlatformAutomerge) { return; } - const repoCache = getCache(); - const { lastPlatformAutomergeFailure } = repoCache; - if (lastPlatformAutomergeFailure) { - const lastFailedAt = DateTime.fromISO(lastPlatformAutomergeFailure); - const now = DateTime.local(); - if (now < lastFailedAt.plus({ hours: 24 })) { - logger.debug( - { prNumber }, - 'GitHub-native automerge: skipping attempt due to earlier failure' - ); - return; - } - delete repoCache.lastPlatformAutomergeFailure; + if (!config.autoMergeAllowed) { + logger.debug( + { prNumber }, + 'GitHub-native automerge: not enabled in repo settings' + ); + return; } try { const mergeMethod = config.mergeMethod?.toUpperCase() || 'MERGE'; const variables = { pullRequestId: prNodeId, mergeMethod }; const queryOptions = { variables }; + const { errors } = await githubApi.requestGraphql( enableAutoMergeMutation, queryOptions ); - if (errors) { - const disabledByPlatform = errors.find( - ({ type, message }) => - type === 'UNPROCESSABLE' && - message === - 'Pull request is not in the correct state to enable auto-merge' - ); - // istanbul ignore else - if (disabledByPlatform) { - logger.debug( - { prNumber }, - 'GitHub automerge is not enabled for this repository' - ); - - const now = DateTime.local(); - repoCache.lastPlatformAutomergeFailure = now.toISO(); - } else { - logger.debug({ prNumber, errors }, 'GitHub automerge unknown error'); - } - } else { - logger.debug('GitHub-native PR automerge enabled'); + if (errors) { + logger.debug({ prNumber, errors }, 'GitHub-native automerge: fail'); + return; } + + logger.debug({ prNumber }, 'GitHub-native automerge: success'); } catch (err) { - logger.warn({ prNumber, err }, 'GitHub automerge: HTTP request error'); + logger.warn({ prNumber, err }, 'GitHub-native automerge: REST API error'); } } diff --git a/lib/platform/github/types.ts b/lib/platform/github/types.ts index 72fd4dd5576a8b..f8e79ff11647f0 100644 --- a/lib/platform/github/types.ts +++ b/lib/platform/github/types.ts @@ -75,6 +75,7 @@ export interface LocalRepoConfig { productLinks: any; ignorePrAuthor: boolean; branchPrs: Pr[]; + autoMergeAllowed: boolean; } export type BranchProtection = any; @@ -84,6 +85,7 @@ export interface GhRepo { isFork: boolean; isArchived: boolean; nameWithOwner: string; + autoMergeAllowed: boolean; mergeCommitAllowed: boolean; rebaseMergeAllowed: boolean; squashMergeAllowed: boolean;