noprs

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.
10
11Inspired by [PRBot][PRBot github], used in the GitHub
12[Linux repository][linux github], this repository provides an automation
13for closing all new pull requests. It differs from PRBot in the
14following ways:
15
161. 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].
19
20## Installation
21
22`noprs` has the following dependencies:
23
241. [PyGithub][pygithub homepage]
252. [hy][hy homepage]
26
27After the dependencies have been installed, the script can be invoked
28directly from the repository. If desired, it can also manually be copied
29to an element in `$PATH` as an executable script.
30
31## Usage
32
33`noprs` is configured via two environment variables:
34
351. `GITHUB_ACCESS_TOKEN`: Must be set to a GitHub API access token.
362. `GITHUB_WEBHOOK_SECRET`: Must be set to the GitHub webhook secret.
37
38After these environment variables have been set, start `noprs`:
39
40	$ hy noprs.hy -a localhost -p 8080 -c my-comment.md
41
42Afterwards, register the webhook on GitHub, either for an entire
43organization or a single repository. The `Content-Type` must be set to
44`application/json` and the webhook must only deliver PR events.
45
46Test if everything works as expected by creating a new GitHub PR.
47
48## License
49
50This program is free software: you can redistribute it and/or modify it
51under the terms of the GNU Affero General Public License as published by
52the Free Software Foundation, either version 3 of the License, or (at
53your option) any later version.
54
55This program is distributed in the hope that it will be useful, but
56WITHOUT ANY WARRANTY; without even the implied warranty of
57MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
58General Public License for more details.
59
60You should have received a copy of the GNU Affero General Public License
61along with this program. If not, see <https://www.gnu.org/licenses/>.
62
63[dear-github #84]: https://github.com/dear-github/dear-github/issues/84
64[PRBot github]: https://github.com/ajdlinux/PRBot
65[linux github]: https://github.com/torvalds/linux/
66[github webhooks]: https://developer.github.com/webhooks/
67[hy homepage]: https://docs.hylang.org
68[pygithub homepage]: https://github.com/PyGithub/PyGithub