Skip to content

Commit 1dc0e06

Browse files
committed
docs: Add installation instructions.
Signed-off-by: BURG3R5 <[email protected]>
1 parent 2e8cac1 commit 1dc0e06

File tree

3 files changed

+109
-7
lines changed

3 files changed

+109
-7
lines changed

README.md

Lines changed: 69 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![CI](https://github.com/mdg-iitr/github-slack-bot/actions/workflows/ci.yml/badge.svg)](https://github.com/mdg-iitr/github-slack-bot/actions/workflows/ci.yml)
22
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
3-
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)
3+
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
44
<!-- ALL-CONTRIBUTORS-BADGE:END -->
55

66
# GitHubBot
@@ -16,6 +16,71 @@ This bot has
1616

1717
than the official GitHub-Slack integration.
1818

19+
### Installation
20+
21+
#### 0. Requirements:
22+
23+
- A server with public endpoints
24+
- Python **3.10.2** or above: [Windows](https://www.python.org/downloads/windows/), [MacOS](https://www.python.org/downloads/macos/), [Linux](https://www.linuxcapable.com/how-to-install-python-3-10-on-ubuntu-20-04/)
25+
- Git
26+
27+
#### 1. Clone this repo
28+
29+
```
30+
$ git clone https://github.com/mdg-iitr/github-slack-bot.git
31+
$ cd github-slack-bot
32+
```
33+
34+
#### 2. Connect to GitHub
35+
36+
- Add `<your-url>/github/events` to your organization or repository's webhooks.
37+
- Set "Content type" to `application/json`
38+
- Check the "Send me everything" radio button
39+
40+
#### 3. Connect to Slack
41+
42+
- Find and replace every instance of `<your-url>` in the [provided manifest](https://github.com/BURG3R5/github-slack-bot/blob/master/bot_manifest.yml) with whatever your server's URL is.
43+
- Go to [link](https://api.slack.com/apps) and create a new app using the edited manifest.
44+
- Install the app to your Slack workspace.
45+
46+
#### 4. Environment variables
47+
48+
- Copy `.env.sample` to `.env`.
49+
- Set `DEBUG` to 0 and the other variables to appropriate values.
50+
51+
#### 5. Create a virtual environment
52+
53+
```
54+
$ python -m venv venv
55+
```
56+
Or, if your system contains both Python 2 and Python 3, use `python3`.
57+
58+
#### 6. Activate your virtual environment
59+
60+
MacOS and Linux:
61+
```
62+
$ source venv/bin/activate
63+
```
64+
65+
Windows:
66+
```
67+
> venv\Scripts\activate
68+
```
69+
70+
#### 7. Install dependencies
71+
72+
```
73+
$ pip install -r requirements.txt
74+
```
75+
76+
Or, if your system contains both Python 2 and Python 3, use `pip3`.
77+
78+
#### 8. Run the bot
79+
80+
```
81+
$ python main.py
82+
```
83+
1984
### Setup for development
2085

2186
#### 0. Requirements:
@@ -37,10 +102,8 @@ $ python -m venv venv
37102
```
38103
Or, if your system contains both Python 2 and Python 3, use `python3`.
39104

40-
41105
#### 3. Activate your virtual environment
42106

43-
44107
MacOS and Linux:
45108
```
46109
$ source venv/bin/activate
@@ -63,16 +126,16 @@ $ pip install pre-commit
63126
$ pre-commit install
64127
```
65128

66-
#### 6. Get the environment variables from another contributor
129+
#### 6. Get the environment variables from a maintainer
67130
#### 7. [Download and configure ngrok](https://betterprogramming.pub/ngrok-make-your-localhost-accessible-to-anyone-333b99e44b07)
68-
#### 8. Send your generated URL to MDG org admins
131+
#### 8. Send your generated URL to a maintainer
69132
#### 9. Run the bot
70133

71134
```
72135
$ python main.py
73136
```
74137

75-
## Contributors ✨
138+
### Contributors ✨
76139

77140
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
78141

bot_manifest.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
display_information:
2+
name: GitHubBot
3+
description: Concisely and precisely informs users of events on GitHub.
4+
background_color: "#000000"
5+
long_description: Concisely and precisely informs users of events on GitHub. Subscribe to any number of events using the `/subscribe` command. Get more usage instructions using the `/help` command. Source code at https://github.com/BURG3R5/github-slack-bot
6+
features:
7+
bot_user:
8+
display_name: GitHubBot
9+
always_online: true
10+
slash_commands:
11+
- command: /subscribe
12+
url: <your-url>/slack/commands
13+
description: Subscribe to events in a GitHub repository
14+
usage_hint: repository event1 [event2, event3, ...]
15+
should_escape: false
16+
- command: /unsubscribe
17+
url: <your-url>/slack/commands
18+
description: Unsubscribe from events in a GitHub repository
19+
usage_hint: repository event1 [event2, event3, ...]
20+
should_escape: false
21+
- command: /help
22+
url: <your-url>/slack/commands
23+
description: Prints instructions and keywords.
24+
should_escape: false
25+
- command: /list
26+
url: <your-url>/slack/commands
27+
description: Lists subscriptions for the current channel.
28+
should_escape: false
29+
oauth_config:
30+
scopes:
31+
bot:
32+
- chat:write
33+
- chat:write.customize
34+
- commands
35+
- files:write
36+
settings:
37+
org_deploy_enabled: false
38+
socket_mode_enabled: false
39+
token_rotation_enabled: false

main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,4 @@ def manage_slack_commands() -> dict | None:
9393
)
9494

9595
bot: SlackBot = SlackBot(token=os.environ["SLACK_OAUTH_TOKEN"])
96-
run(host="", port=5556, debug=True)
96+
run(host="", port=5556, debug=debug)

0 commit comments

Comments
 (0)