renovate icon indicating copy to clipboard operation
renovate copied to clipboard

Don't try other merge method on github when required status checks are missing

Open viceice opened this issue 3 years ago • 1 comments

How are you running Renovate?

Mend Renovate hosted app on github.com

If you're self-hosting Renovate, tell us what version of Renovate you run.

No response

If you're self-hosting Renovate, select which platform you are using.

No response

If you're self-hosting Renovate, tell us what version of the platform you run.

No response

Was this something which used to work for you, and then stopped?

I never saw this working

Describe the bug

Renovate retries other merge methods on github

happens here: https://github.com/renovatebot/osv-offline

We should check response and break early

DEBUG: GitHub blocking PR merge -- will keep trying(branch="renovate/jest-monorepo")
{
  "response": {
    "message": "Required status check \"build\" is expected.",
    "documentation_url": "https://docs.github.com/articles/about-protected-branches"
  }
}

Relevant debug logs

Logs
DEBUG: mergePr(57, renovate/jest-monorepo)(branch="renovate/jest-monorepo")
DEBUG: mergePr(branch="renovate/jest-monorepo")
{
  "options": {
    "body": {
      "merge_method": "squash"
    }
  },
  "url": "repos/renovatebot/osv-offline/pulls/57/merge"
}
DEBUG: Unknown GitHub error(branch="renovate/jest-monorepo")
{
  "err": {
    "name": "HTTPError",
    "code": "ERR_NON_2XX_3XX_RESPONSE",
    "timings": {
      "start": 1663138182418,
      "socket": 1663138182418,
      "lookup": 1663138182426,
      "connect": 1663138182426,
      "secureConnect": 1663138182437,
      "upload": 1663138182437,
      "response": 1663138182942,
      "end": 1663138182943,
      "phases": {
        "wait": 0,
        "dns": 8,
        "tcp": 0,
        "tls": 11,
        "request": 0,
        "firstByte": 505,
        "download": 1,
        "total": 525
      }
    },
    "message": "Response code 405 (Method Not Allowed)",
    "stack": "HTTPError: Response code 405 (Method Not Allowed)\n    at Request.<anonymous> (/home/ubuntu/renovateapp/node_modules/got/dist/source/as-promise/index.js:118:42)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)",
    "options": {
      "headers": {
        "user-agent": "Renovate Bot (GitHub App 2740)",
        "accept": "application/vnd.github.machine-man-preview+json",
        "authorization": "***********",
        "content-type": "application/json",
        "content-length": "25",
        "accept-encoding": "gzip, deflate, br"
      },
      "url": "https://api.github.com/repos/renovatebot/osv-offline/pulls/57/merge",
      "hostType": "github",
      "username": "",
      "password": "",
      "method": "PUT",
      "http2": false
    },
    "response": {
      "statusCode": 405,
      "statusMessage": "Method Not Allowed",
      "body": {
        "message": "Required status check \"build\" is expected.",
        "documentation_url": "https://docs.github.com/articles/about-protected-branches"
      },
      "headers": {
        "server": "GitHub.com",
        "date": "Wed, 14 Sep 2022 06:49:42 GMT",
        "content-type": "application/json; charset=utf-8",
        "content-length": "138",
        "x-github-media-type": "github.v3; param=machine-man-preview; format=json",
        "x-ratelimit-limit": "5900",
        "x-ratelimit-remaining": "5675",
        "x-ratelimit-reset": "1663138715",
        "x-ratelimit-used": "225",
        "x-ratelimit-resource": "core",
        "access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
        "access-control-allow-origin": "*",
        "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
        "x-frame-options": "deny",
        "x-content-type-options": "nosniff",
        "x-xss-protection": "0",
        "referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
        "content-security-policy": "default-src 'none'",
        "vary": "Accept-Encoding, Accept, X-Requested-With",
        "x-github-request-id": "CBB8:4916:363D508:379F7E0:63217986",
        "connection": "close"
      },
      "httpVersion": "1.1"
    }
  }
}
DEBUG: GitHub blocking PR merge -- will keep trying(branch="renovate/jest-monorepo")
{
  "response": {
    "message": "Required status check \"build\" is expected.",
    "documentation_url": "https://docs.github.com/articles/about-protected-branches"
  }
}
DEBUG: mergePr(branch="renovate/jest-monorepo")
{
  "options": {
    "body": {
      "merge_method": "rebase"
    }
  },
  "url": "repos/renovatebot/osv-offline/pulls/57/merge"
}
DEBUG: Unknown GitHub error(branch="renovate/jest-monorepo")
{
  "err": {
    "name": "HTTPError",
    "code": "ERR_NON_2XX_3XX_RESPONSE",
    "timings": {
      "start": 1663138182949,
      "socket": 1663138182949,
      "lookup": 1663138182958,
      "connect": 1663138182958,
      "secureConnect": 1663138182969,
      "upload": 1663138182970,
      "response": 1663138183286,
      "end": 1663138183286,
      "phases": {
        "wait": 0,
        "dns": 9,
        "tcp": 0,
        "tls": 11,
        "request": 1,
        "firstByte": 316,
        "download": 0,
        "total": 337
      }
    },
    "message": "Response code 405 (Method Not Allowed)",
    "stack": "HTTPError: Response code 405 (Method Not Allowed)\n    at Request.<anonymous> (/home/ubuntu/renovateapp/node_modules/got/dist/source/as-promise/index.js:118:42)\n    at runMicrotasks (<anonymous>)\n    at processTicksAndRejections (node:internal/process/task_queues:96:5)",
    "options": {
      "headers": {
        "user-agent": "Renovate Bot (GitHub App 2740)",
        "accept": "application/vnd.github.machine-man-preview+json",
        "authorization": "***********",
        "content-type": "application/json",
        "content-length": "25",
        "accept-encoding": "gzip, deflate, br"
      },
      "url": "https://api.github.com/repos/renovatebot/osv-offline/pulls/57/merge",
      "hostType": "github",
      "username": "",
      "password": "",
      "method": "PUT",
      "http2": false
    },
    "response": {
      "statusCode": 405,
      "statusMessage": "Method Not Allowed",
      "body": {
        "message": "Rebase merges are not allowed on this repository.",
        "documentation_url": "https://docs.github.com/rest/reference/pulls#merge-a-pull-request"
      },
      "headers": {
        "server": "GitHub.com",
        "date": "Wed, 14 Sep 2022 06:49:43 GMT",
        "content-type": "application/json; charset=utf-8",
        "content-length": "151",
        "x-github-media-type": "github.v3; param=machine-man-preview; format=json",
        "x-ratelimit-limit": "5900",
        "x-ratelimit-remaining": "5674",
        "x-ratelimit-reset": "1663138715",
        "x-ratelimit-used": "226",
        "x-ratelimit-resource": "core",
        "access-control-expose-headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
        "access-control-allow-origin": "*",
        "strict-transport-security": "max-age=31536000; includeSubdomains; preload",
        "x-frame-options": "deny",
        "x-content-type-options": "nosniff",
        "x-xss-protection": "0",
        "referrer-policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
        "content-security-policy": "default-src 'none'",
        "vary": "Accept-Encoding, Accept, X-Requested-With",
        "x-github-request-id": "CBBA:9212:1334D8F:13C4624:63217986",
        "connection": "close"
      },
      "httpVersion": "1.1"
    }
  }
}

Have you created a minimal reproduction repository?

No reproduction, but I have linked to a public repo where it occurs

viceice avatar Sep 14 '22 06:09 viceice

Looks like we should search for the "Required status check" string and add intelligence for that condition

rarkins avatar Sep 14 '22 08:09 rarkins

:tada: This issue has been resolved in version 35.18.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

renovate-release avatar Mar 23 '23 09:03 renovate-release