probot / no-response

a GitHub App that closes issues where the author hasn't responded to a request for more information
ISC License
107 stars 22 forks source link

If failure occurs when posting close comment, don't close issue #28

Closed jasonrudolph closed 6 years ago

jasonrudolph commented 6 years ago

Fixes #24 ... probably 🤞

Context

https://github.com/probot/no-response/issues/24 describes a problem where probot/no-response sometimes closes an issue without posting a comment. We suspect that probot/no-response is attempting to post a comment but is having the comment rejected by GitHub's abuse prevention rate limits, similar to the issue experienced by probot/stale in https://github.com/probot/stale/issues/26.

Proposed remedy

Following the approach implemented in https://github.com/probot/stale/pull/64, this pull request updates probot/no-response to first attempt to post the comment saying that it is closing the issue. If it successfully posts the comment, then it closes the issue. If an error occurs when posting the comment, it does not close the issue.

Verification process

Using a locally-running instance of probot/no-response:

  1. Install the local probot/no-response app on a repository on github.com
  2. Ensure that the repository has an issue that has gone more than daysUntilClose without a response from the issue author
  3. Test the behavior affected by this pull request:
    • [x] Run the sweep function and use Little Snitch to block the HTTP request that attempts to post the comment. Verify that the comment is not posted and the issue is not closed.
    • [x] Configure Little Snitch to allow all HTTP requests to flow in/out of the app. Run the sweep function and verify that it leaves a comment and closes the issue.

/cc @lee-dohm for review

lee-dohm commented 6 years ago

Looks awesome! 💖

Thanks so much :bow:

jasonrudolph commented 6 years ago

@lee-dohm: Thanks for the lightning fast review. :zap::bow: