Skip to content

Commit

Permalink
docs: Add installation instructions.
Browse files Browse the repository at this point in the history
  • Loading branch information
BURG3R5 committed May 4, 2022
2 parents 2e8cac1 + 1dc0e06 commit 4acfe60
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 7 deletions.
75 changes: 69 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![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)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->

# GitHubBot
Expand All @@ -16,6 +16,71 @@ This bot has

than the official GitHub-Slack integration.

### Installation

#### 0. Requirements:

- A server with public endpoints
- 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/)
- Git

#### 1. Clone this repo

```
$ git clone https://github.com/mdg-iitr/github-slack-bot.git
$ cd github-slack-bot
```

#### 2. Connect to GitHub

- Add `<your-url>/github/events` to your organization or repository's webhooks.
- Set "Content type" to `application/json`
- Check the "Send me everything" radio button

#### 3. Connect to Slack

- 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.
- Go to [link](https://api.slack.com/apps) and create a new app using the edited manifest.
- Install the app to your Slack workspace.

#### 4. Environment variables

- Copy `.env.sample` to `.env`.
- Set `DEBUG` to 0 and the other variables to appropriate values.

#### 5. Create a virtual environment

```
$ python -m venv venv
```
Or, if your system contains both Python 2 and Python 3, use `python3`.

#### 6. Activate your virtual environment

MacOS and Linux:
```
$ source venv/bin/activate
```

Windows:
```
> venv\Scripts\activate
```

#### 7. Install dependencies

```
$ pip install -r requirements.txt
```

Or, if your system contains both Python 2 and Python 3, use `pip3`.

#### 8. Run the bot

```
$ python main.py
```

### Setup for development

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


#### 3. Activate your virtual environment


MacOS and Linux:
```
$ source venv/bin/activate
Expand All @@ -63,16 +126,16 @@ $ pip install pre-commit
$ pre-commit install
```

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

```
$ python main.py
```

## Contributors ✨
### Contributors ✨

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

Expand Down
39 changes: 39 additions & 0 deletions bot_manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
display_information:
name: GitHubBot
description: Concisely and precisely informs users of events on GitHub.
background_color: "#000000"
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
features:
bot_user:
display_name: GitHubBot
always_online: true
slash_commands:
- command: /subscribe
url: <your-url>/slack/commands
description: Subscribe to events in a GitHub repository
usage_hint: repository event1 [event2, event3, ...]
should_escape: false
- command: /unsubscribe
url: <your-url>/slack/commands
description: Unsubscribe from events in a GitHub repository
usage_hint: repository event1 [event2, event3, ...]
should_escape: false
- command: /help
url: <your-url>/slack/commands
description: Prints instructions and keywords.
should_escape: false
- command: /list
url: <your-url>/slack/commands
description: Lists subscriptions for the current channel.
should_escape: false
oauth_config:
scopes:
bot:
- chat:write
- chat:write.customize
- commands
- files:write
settings:
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: false
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,4 @@ def manage_slack_commands() -> dict | None:
)

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

0 comments on commit 4acfe60

Please sign in to comment.