Skip to content

Commit

Permalink
Merge pull request #30 from gene1wood/support_historical_bot_names
Browse files Browse the repository at this point in the history
Add support for optional config setting historical_github_usernames
  • Loading branch information
gene1wood authored May 3, 2020
2 parents a7dfe9c + ced56db commit 646ade7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit 646ade7

Please sign in to comment.