-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* v2.0.0 * Progress commit on v2.0.0 - more tests and refactor * Progress commit - massive enhancements to testing * Progress commit - mostly working GitHub * App fully working - progress commit * Finished adding tests, updating docs, added entrypoint
- Loading branch information
1 parent
db644fc
commit d98d076
Showing
27 changed files
with
1,172 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[report] | ||
exclude_lines = | ||
if __name__ == '__main__': | ||
PullBugCLI() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[flake8] | ||
max-line-length=120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ __pycache__ | |
build | ||
dist | ||
pullbug.egg-info | ||
venv | ||
htmlcov | ||
.coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,26 @@ | ||
language: python | ||
|
||
python: | ||
- "3.6" | ||
- "3.7" | ||
- "3.8" | ||
- '3.6' | ||
- '3.7' | ||
- '3.8' | ||
|
||
install: | ||
install: | ||
- pip install -e ."[dev]" | ||
|
||
script: | ||
- pylint pullbug/*.py | ||
script: | ||
- flake8 pullbug/*.py | ||
- flake8 test/*.py | ||
- pytest --cov=pullbug | ||
|
||
deploy: | ||
provider: pypi | ||
username: __token__ | ||
password: | ||
secure: ERovLDnoiwXYbsIUy9u+CygvA+Hh3Tf2kAAY6Yenhsrj54HQj+llSBo/l/uor5G8PMtdn7McciddGlh10FLuBq8a1E2SHReDaIiSU/dUdcu5ot9/GHdFkgozmfhMgxbsZsT/XvdbtApP7IXv4DjRE80DIg1hAFzycBLqphMF8xrQGq1aVo72A7jNHtqyH1hdTh8LpPv045L5USbFwiP81Rjjk5kCqd5A7lyneZnRCpbh/WcvqPjDcFoIrLmh/1bdVP1EFyH5yFV9Zfu3TIf7wSXbNC2nC2+bg9kdI3cZ0Y86HZRBNcbC+9QuluFI2hlbhnoAsEbHLAEYfPMxjgr1V9PlEpEw5TfWAVQJJc3ILbfJQ6lyX3K7QuBwRkgpRPgioLw8nzVk2jjsLKhygx3Bf3BR/A4MIgzi7akR+egSZXEHKcoB/LE3EehzzOi5c3hsjn+3CQuSvgmmrp3Oc7Jnze3WOY+bb4QzlQ6IBJrUrpjAYGYBWjRP46mIsbX8nHH3lWOKYnw6zxDf9F2mwOFGXpeHzGMjq9NJfgDXDqLdbETvFL05nRiUVL/SF8kV9Lo7lu+r6YamGkWu/GYpga2mr2DBtVHt9M+JtApORH3ojA6k2xYR0q3I5HMWpMFuYu6LKxQpg1A8CyQtpRM8pOZmLicGpqxlTv5/OhWzEkgLiDY= | ||
on: | ||
tags: true | ||
skip_existing: true | ||
|
||
after_success: | ||
- coveralls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
VIRTUALENV := python3 -m venv | ||
|
||
## help - Display help about make targets for this Makefile | ||
help: | ||
@cat Makefile | grep '^## ' --color=never | cut -c4- | sed -e "`printf 's/ - /\t- /;'`" | column -s "`printf '\t'`" -t | ||
|
||
## venv - Install the virtual environment | ||
venv: | ||
$(VIRTUALENV) ~/.venv/pullbug/ | ||
ln -snf ~/.venv/pullbug/ venv | ||
venv/bin/pip install -e ."[dev]" | ||
|
||
## install - Install the project locally | ||
install: | venv | ||
|
||
## clean - Remove the virtual environment and clear out .pyc files | ||
clean: | ||
rm -rf ~/.venv/pullbug/ venv | ||
find . -name '*.pyc' -delete | ||
rm -rf dist | ||
rm -rf build | ||
rm -rf *.egg-info | ||
|
||
## lint - Lint the project | ||
lint: | ||
venv/bin/flake8 pullbug/*.py | ||
venv/bin/flake8 test/*.py | ||
|
||
## test - Test the project | ||
test: | ||
venv/bin/pytest | ||
|
||
## coverage - Test the project and generate an HTML coverage report | ||
coverage: | ||
venv/bin/pytest --cov=pullbug --cov-branch --cov-report=html | ||
|
||
.PHONY: help install clean lint test coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,85 @@ | ||
<div align="center"> | ||
|
||
# Pull Bug | ||
# Pull Bug 🐛 | ||
|
||
🐛 Pull Bug is great at bugging you to merge or close your pull/merge requests. | ||
Get bugged via Slack or RocketChat to merge your GitHub pull requests or GitLab merge requests. | ||
|
||
[![Build Status](https://travis-ci.com/Justintime50/pull-bug.svg?branch=master)](https://travis-ci.com/Justintime50/pull-bug) | ||
[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://opensource.org/licenses/mit-license.php) | ||
[![Coverage Status](https://coveralls.io/repos/github/Justintime50/pull-bug/badge.svg?branch=master)](https://coveralls.io/github/Justintime50/pull-bug?branch=master) | ||
[![PyPi](https://img.shields.io/pypi/v/pull-bug)](https://pypi.org/project/pull-bug) | ||
[![Licence](https://img.shields.io/github/license/justintime50/pull-bug)](LICENSE) | ||
|
||
<img src="assets/showcase.png"> | ||
|
||
</div> | ||
|
||
Pull Bug is a script that can be run on a cron to notify you on Slack or Rocket.Chat of all open pull and merge requests from GitHub or GitLab. This tool ensures requests never go unnoticed as it constantly bugs you to merge or close your work. This is perfect for finding old stale requests and staying on top of current ones. Pass in a few environment variables, setup a [Slackbot](https://slack.com/help/articles/115005265703-Create-a-bot-for-your-workspace) or [Rocket.Chat integration](https://rocket.chat/docs/developer-guides/rest-api/integration/create/) and you're all set to be bugged by Pull Bug. | ||
Pull Bug can notify you on Slack or Rocket.Chat of all open pull and merge requests from GitHub or GitLab. This tool ensures requests never go unnoticed as it can be setup on a schedule to constantly bug you to merge your work. This is perfect for finding old or stale requests and helps you to stay current on new ones. Pass in a few environment variables, setup a [Slackbot](https://slack.com/help/articles/115005265703-Create-a-bot-for-your-workspace) or [Rocket.Chat](https://rocket.chat/docs/developer-guides/rest-api/integration/create/) integration and you're all set to be bugged by Pull Bug. | ||
|
||
**NOTE:** Pull Bug works best if you have link unfurling turned off for GitHub and GitLab on Slack or Rocket.Chat. | ||
**GitLab Users:** Pull Bug assumes you are self hosting your organization's GitLab instance (all merge requests will be checked for by default). If you are not hosting your own and are instead using gitlab.com, it's recommended to change the scope to "owner" and provide an owner who has access to all your organizations merge requests. | ||
**GitLab Users:** If you are not hosting your own GitLab instance and are instead using `gitlab.com`, it's recommended to change the scope to `owner` and provide an owner who has access to all your organizations merge requests. | ||
|
||
## Install | ||
|
||
```bash | ||
# Install Pull Bug | ||
# Install tool | ||
pip3 install pullbug | ||
|
||
# Copy and fill out the .env file | ||
cp .env.example .env | ||
# Install locally | ||
make install | ||
|
||
# Get Makefile help | ||
make help | ||
``` | ||
|
||
## Usage | ||
|
||
Pull Bug is intended to be run on a cron, launch agent, or via Docker at whatever interval you'd like to be notified via Slack or Rocket.Chat. | ||
|
||
Pick and choose for your needs. Build only GitLab/GitHub messages, combine them into one. Send to Slack or Rocket.Chat - maybe both! | ||
|
||
```python | ||
import pullbug | ||
Pull Bug works best when run on a schedule. Run one-off reports or setup Pull Bug to notify you at whatever interval you'd like to be bugged via Slack or Rocket.Chat about pull or merge requests. | ||
|
||
# Build messages | ||
github_message = pullbug.Git.github() | ||
gitlab_message = pullbug.Git.gitlab() | ||
message = github_message + gitlab_message | ||
Pull Bug is highly customizable allowing you to mix and match version control software along with messaging platforms to get the right fit. Additionally choose which kinds of pull or merge requests to retrieve. | ||
|
||
# Send messages | ||
pullbug.Messages.rocket_chat(message) | ||
pullbug.Messages.slack(message) | ||
``` | ||
|
||
### Commands | ||
|
||
```bash | ||
# Run our examples | ||
python3 examples/slack_message.py | ||
|
||
# Run the following for Docker (environment variables must be set in docker-compose.yml) | ||
docker-compose up -d | ||
Usage: | ||
GITHUB_TOKEN=123... SLACK_BOT_TOKEN=123... SLACK_CHANNEL=my-channel pullbug --github --github_owner my_org --slack | ||
Options: | ||
-h, --help show this help message and exit | ||
-gh, --github Get bugged about pull requests from GitHub. | ||
-gl, --gitlab Get bugged about merge requests from GitLab. | ||
-s, --slack Send Pull Bug messages to Slack. | ||
-rc, --rocketchat Send Pull Bug messages to Rocket.Chat. | ||
-w, --wip Include "Work in Progress" pull or merge requests. | ||
-gho GITHUB_OWNER, --github_owner GITHUB_OWNER | ||
The GitHub owner to retrieve pull requests from (can be a user or org). | ||
-ghs GITHUB_STATE, --github_state GITHUB_STATE | ||
The GitHub state to retrieve pull requests with. (Default: open | closed | all) | ||
-ghc GITHUB_CONTEXT, --github_context GITHUB_CONTEXT | ||
The GitHub context to retrieve pull requests with (Default: orgs | users). | ||
-glst GITLAB_STATE, --gitlab_state GITLAB_STATE | ||
The GitLab state to retrieve merge requests with. (Default: opened | closed | locked | merged) | ||
-glsc GITLAB_SCOPE, --gitlab_scope GITLAB_SCOPE | ||
The GitLab state to retrieve pull requests with. (Default: all | created_by_me | assigned_to_me) | ||
Environment Variables: | ||
GITHUB_TOKEN The GitHub Token used to authenticate with the GitHub API. | ||
GITLAB_API_KEY The GitLab API Key used to authenticate with the GitLab API. | ||
GITLAB_API_URL The GitLab API url for your GitLab instance. Default: https://gitlab.com/api/v4. | ||
SLACK_BOT_TOKEN The Slackbot Token used to authenticate with Slack. | ||
SLACK_CHANNEL The Slack channel to post a message to. | ||
ROCKET_CHAT_URL The Rocket.Chat url of the room to post a message to. | ||
``` | ||
|
||
## Development | ||
|
||
```bash | ||
# Install dev dependencies | ||
pip3 install -e ."[dev]" | ||
# Lint the project | ||
make lint | ||
|
||
# Run tests | ||
make test | ||
|
||
# Run test coverage | ||
make coverage | ||
|
||
# Run linting | ||
pylint pullbug/*.py | ||
# Run the tool locally | ||
venv/bin/python pullbug/cli.py --help | ||
``` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
"""Import Pull Bug Modules""" | ||
from .git import Git | ||
from .messages import Messages | ||
# flake8: noqa | ||
from pullbug.github_bug import GithubBug | ||
from pullbug.gitlab_bug import GitlabBug | ||
from pullbug.logger import PullBugLogger | ||
from pullbug.messages import Messages |
Oops, something went wrong.