GitHub webhook for closing all new GitHub PRs with a costum message
git clone https://git.8pit.net/noprs.git
1# noprs 2 3GitHub webhook for closing all new GitHub PRs with a custom message. 4 5## Motivation 6 7GitHub does not support [deactivating pull requests][dear-github #84]. 8However, some organization do not want to use the GitHub PR feature and 9only use GitHub as a read-only git mirror.1011Inspired by [PRBot][PRBot github], used in the GitHub12[Linux repository][linux github], this repository provides an automation13for closing all new pull requests. It differs from PRBot in the14following ways:15161. It uses [GitHub webhooks][github webhooks] and does not require a cronjob.172. It optionally closes the GitHub PR in addition to adding a configurable comment.183. It is written in [hy][hy homepage].1920## Installation2122`noprs` has the following dependencies:23241. [PyGithub][pygithub homepage]252. [hy][hy homepage]2627After the dependencies have been installed, the script can be invoked28directly from the repository. If desired, it can also manually be copied29to an element in `$PATH` as an executable script.3031## Usage3233`noprs` is configured via two environment variables:34351. `GITHUB_ACCESS_TOKEN`: Must be set to a GitHub API access token.362. `GITHUB_WEBHOOK_SECRET`: Must be set to the GitHub webhook secret.3738After these environment variables have been set, start `noprs`:3940 $ hy noprs.hy -a localhost -p 8080 -c my-comment.md4142Afterwards, register the webhook on GitHub, either for an entire43organization or a single repository. The `Content-Type` must be set to44`application/json` and the webhook must only deliver PR events.4546Test if everything works as expected by creating a new GitHub PR.4748## License4950This program is free software: you can redistribute it and/or modify it51under the terms of the GNU Affero General Public License as published by52the Free Software Foundation, either version 3 of the License, or (at53your option) any later version.5455This program is distributed in the hope that it will be useful, but56WITHOUT ANY WARRANTY; without even the implied warranty of57MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero58General Public License for more details.5960You should have received a copy of the GNU Affero General Public License61along with this program. If not, see <https://www.gnu.org/licenses/>.6263[dear-github #84]: https://github.com/dear-github/dear-github/issues/8464[PRBot github]: https://github.com/ajdlinux/PRBot65[linux github]: https://github.com/torvalds/linux/66[github webhooks]: https://developer.github.com/webhooks/67[hy homepage]: https://docs.hylang.org68[pygithub homepage]: https://github.com/PyGithub/PyGithub