-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tickets added to GitHub projects will be added to Milestones of the same name. Changes on a project board which is closed will not have an affect on the milestone.
- Loading branch information
1 parent
3cc7338
commit 7d0cad3
Showing
10 changed files
with
57 additions
and
24 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 |
---|---|---|
@@ -1,2 +1 @@ | ||
GITHUB_USER=supmanbot | ||
GITHUB_PSX="ha! wouldn't you like to know" | ||
READ_DOT_ENV_FILE=True |
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 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,8 +1,15 @@ | ||
# Load our conf | ||
from . import Env | ||
import environ | ||
|
||
env = Env() | ||
|
||
READ_DOT_ENV_FILE = env('READ_DOT_ENV_FILE', default=False) | ||
if READ_DOT_ENV_FILE: | ||
# OS environment variables take precedence over variables from .env | ||
ROOT_DIR = environ.Path(__file__) - 2 | ||
env.read_env(str(ROOT_DIR.path('.env'))) | ||
|
||
DEBUG = env('DEBUG', default=False, cast=bool) | ||
GITHUB_USER = env('GITHUB_USER') | ||
GITHUB_PSX = env('GITHUB_PSX') |
Empty file.
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
Empty file.
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,6 +1,39 @@ | ||
from gnome.policies import Policy | ||
from gnome.gh import Repo, Issue, gh | ||
|
||
|
||
class SyncProjectMilestones(Policy): | ||
def dispatch_gnome(self): | ||
pass | ||
headers = self.callback.headers() | ||
event = headers['X-GitHub-Event'] | ||
|
||
if event not in ('project_card'): | ||
return | ||
|
||
payload = self.callback.payload() | ||
card = payload['project_card'] | ||
if not payload['action'] == 'deleted': | ||
if 'content_url' in card: | ||
# Is a ticket | ||
repo_name = payload['repository']['full_name'] | ||
issue_url = card['content_url'] | ||
issue_number = issue_url.split('/')[-1] | ||
repo = Repo(repo_name) | ||
gh_issue = repo._repo.get_issue(int(issue_number)) | ||
issue = Issue(repo, gh_issue) | ||
|
||
# Project details | ||
project_url = payload['project_card']['project_url'] | ||
project_id = project_url.split('/')[-1] | ||
project = gh.get_project(int(project_id)) | ||
project_name = project.name | ||
|
||
if project.state == 'closed': | ||
return | ||
|
||
if gh_issue.milestone \ | ||
and gh_issue.milestone.title == project_name: | ||
print('Milestone already set - aborting') | ||
return | ||
|
||
issue.move_to_milestone(project_name) |
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 |
---|---|---|
@@ -1,8 +1,7 @@ | ||
flask | ||
zappa | ||
PyGithub | ||
PyGithub==1.43.2 | ||
requests | ||
ipaddress | ||
PyYAML==3.12 | ||
python-dotenv | ||
envparse==0.2.0 | ||
django-environ==0.4.5 # https://github.com/joke2k/django-environ |