Skip to content

Commit 544b854

Browse files
committed
Use Repository content API to get consensus file
1 parent 70afc55 commit 544b854

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

gitconsensus/repository.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import base64
12
import datetime
23
import github3
34
import json
@@ -28,7 +29,7 @@
2829
2930
"""
3031

31-
consensus_url_template = "https://raw.githubusercontent.com/%s/%s/master/.gitconsensus.yaml"
32+
consensus_url_template = "https://api.github.com/repos/%s/%s/contents/.gitconsensus.yaml"
3233

3334

3435
def githubApiRequest(url, client):
@@ -50,7 +51,8 @@ def __init__(self, user, repository, client):
5051
res = githubApiRequest(consensusurl, self.client)
5152
self.rules = False
5253
if res.status_code == 200:
53-
self.rules = yaml.load(res.text)
54+
ruleresults = res.json()
55+
self.rules = yaml.load(base64.b64decode(ruleresults['content']).decode('utf-8'))
5456
# support older versions by converting from day to hours.
5557
if 'version' not in self.rules or self.rules['version'] < 2:
5658
if 'mergedelay' in self.rules and self.rules['mergedelay']:

0 commit comments

Comments
 (0)