Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add status code 100 as valid GitHub post response #152

Merged

Conversation

mrrobot47
Copy link
Contributor

While using vip-go-ci in GitHub actions via action-phpcs-code-review, recently we started getting an additional comment along with the requested changes from phpcs scan done by vip-go-ci:

GitHub API communication error. Please contact a human. (commit-ID: <id>).

On debugging $resp_headers when the post request to submit review comments was done,

the following dump was obtained.
array(24) {
  ["status"]=>
  array(1) {
    [0]=>
    string(3) "100"
  }
  ["server"]=>
  array(1) {
    [0]=>
    string(10) "GitHub.com"
  }
  ["date"]=>
  array(1) {
    [0]=>
    string(29) "Thu, 11 Mar 2021 11:33:16 GMT"
  }
  ["content-type"]=>
  array(1) {
    [0]=>
    string(31) "application/json; charset=utf-8"
  }
  ["content-length"]=>
  array(1) {
    [0]=>
    string(4) "1766"
  }
  ["cache-control"]=>
  array(1) {
    [0]=>
    string(32) "private, max-age=60, s-maxage=60"
  }
  ["vary"]=>
  array(2) {
    [0]=>
    string(43) "Accept, Authorization, Cookie, X-GitHub-OTP"
    [1]=>
    string(41) "Accept-Encoding, Accept, X-Requested-With"
  }
  ["etag"]=>
  array(1) {
    [0]=>
    string(66) ""<redacted>""
  }
  ["x-oauth-scopes"]=>
  array(1) {
    [0]=>
    string(32) "repo, workflow, write:discussion"
  }
  ["x-accepted-oauth-scopes"]=>
  array(1) {
    [0]=>
    string(0) ""
  }
  ["x-github-media-type"]=>
  array(1) {
    [0]=>
    string(22) "github.v3; format=json"
  }
  ["x-ratelimit-limit"]=>
  array(1) {
    [0]=>
    string(4) "5000"
  }
  ["x-ratelimit-remaining"]=>
  array(1) {
    [0]=>
    string(4) "4924"
  }
  ["x-ratelimit-reset"]=>
  array(1) {
    [0]=>
    string(10) "1615464816"
  }
  ["x-ratelimit-used"]=>
  array(1) {
    [0]=>
    string(2) "76"
  }
  ["access-control-expose-headers"]=>
  array(1) {
    [0]=>
    string(226) "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, Deprecation, Sunset"
  }
  ["access-control-allow-origin"]=>
  array(1) {
    [0]=>
    string(1) "*"
  }
  ["strict-transport-security"]=>
  array(1) {
    [0]=>
    string(44) "max-age=31536000; includeSubdomains; preload"
  }
  ["x-frame-options"]=>
  array(1) {
    [0]=>
    string(4) "deny"
  }
  ["x-content-type-options"]=>
  array(1) {
    [0]=>
    string(7) "nosniff"
  }
  ["x-xss-protection"]=>
  array(1) {
    [0]=>
    string(13) "1; mode=block"
  }
  ["referrer-policy"]=>
  array(1) {
    [0]=>
    string(57) "origin-when-cross-origin, strict-origin-when-cross-origin"
  }
  ["content-security-policy"]=>
  array(1) {
    [0]=>
    string(18) "default-src 'none'"
  }
  ["x-github-request-id"]=>
  array(1) {
    [0]=>
    string(32) "<redacted>"
  }
}

The received status code was 100, leading to failure in this condition and that is why the comment with the error was getting posted.

The HTTP 100 Continue informational status response code indicates that everything so far is OK and that the client should continue with the request or ignore it if it is already finished.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100

With this patch, vip-go-ci started working normally as before in GitHub actions. Please let me know if this is the right way forward or if any other changes are needed.

Signed-off-by: Riddhesh Sanghvi <riddhesh237@gmail.com>
@mrrobot47 mrrobot47 requested a review from gudmdharalds as a code owner March 11, 2021 12:32
@gudmdharalds gudmdharalds self-assigned this May 7, 2021
@gudmdharalds gudmdharalds added this to the 1.0.6 milestone May 14, 2021
Copy link
Contributor

@gudmdharalds gudmdharalds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution! This looks good.

@gudmdharalds
Copy link
Contributor

Added to changelog in #178.

@gudmdharalds gudmdharalds merged commit f64419c into Automattic:master May 26, 2021
@mrrobot47 mrrobot47 deleted the fix-api-communication-error branch May 27, 2021 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants