Upgrading to Staticman V3 and Github Pull Request Problems
Almost two years ago, I implemented a new commenting system called Staticman.
While Staticman has worked well, it also hasn’t been smooth sailing.
Previously I had a weird issue where Staticman was failing to create pull request and another where entries had additional unset fields. Both of these issues have since been resolved, and mostly transparent to any visitors to my site.
I’m now facing a couple more issues, which I’m attempting to resolve.
First, the Staticman Bot has a rate limit if it’s used as a user - Github specifically has a rate limit of 5,000 hits per hour per user. Now, I do get a lot of spam comments, but I highly doubt I get more than 5,000 an hour.
Sample error message.
What is happening here is that I am not the only person or site that uses Staticman. Staticman has become quite popular. As I write this, Staticman has 1,437 stars on Github.
To solve this issue, Staticman was changed from a Github User to a Github App.
I have upgraded to Staticman as an App (known as Staticman v3).
The steps to upgrade Staticman from a User to an App are:
staticmanappas a collaborator
- Go to https://github.com/apps/staticman-net and install the application on your repository
- Submit a comment to the new v3 endpoint, using dev.staticman.net as the base URL – i.e. https://dev.staticman.net/v3/entry/github/[USERNAME]/[REPOSITORY]/[BRANCH]
However, things aren’t completely resolved. I’m still occasionally getting the “too many requests” error. When things do go through, Staticman fails to create a pull request, although a branch is made and the comment goes through. Users will see the following message:
I have three theories as to what is happening:
- Staticman no longer has pull request permission due to the large number of spam PRs
- Apps in general no longer have pull request permission due to the large number of spam PRs
- Something else I’m doing wrong
- Something else wrong with Staticman
I verified that #2 is not true by using ImgBot to optimize my images.
I’ve not fully resolved everything as of yet. If you see an error, so long as it isn’t the “too many requests” error, your comment probably went through. If you do get the “too many requests” error, the timestamp should give you a clue as to when you can resubmit.