Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for optional config setting historical_github_usernames #30

Merged
merged 2 commits into from
May 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions birch_girder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1005,12 +1005,13 @@ def github_hook(self):
'GitHub IssueCommentEvent action in SNS message was "%s" so '
'it will be ignored' % message['action'])
return False
if message['issue']['user']['login'] != self.config['github_username']:
github_usernames = self.config.get('historical_github_usernames', []) + [self.config['github_username']]
if message['issue']['user']['login'] not in github_usernames:
logger.info(
'GitHub issue was not created by %s so it will be ignored'
% self.config['github_username'])
return False
if message['comment']['user']['login'] == self.config['github_username']:
if message['comment']['user']['login'] in github_usernames:
logger.info(
'GitHub issue comment was made by %s so it will be ignored'
% self.config['github_username'])
Expand Down
3 changes: 3 additions & 0 deletions birch_girder/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@ def main():
note_url = 'http://github.com/gene1wood/birch-girder'
scopes = ['repo']

# Note this method of obtaining a token is now deprecated and stops working later in 2020
# https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/
# TODO : Replace this with a non deprecated method
auth = GitHub(config['github_username'], password)
status, authorization_data = auth.authorizations.post(body={
'scopes': scopes,
Expand Down