Skip to content

Commit 41144da

Browse files
author
Emerson Knapp
committed
Make since optional in contrib report
Signed-off-by: Emerson Knapp <eknapp@amazon.com>
1 parent 611247e commit 41144da

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

ros_github_scripts/generate_contribution_report.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262

6363

6464
def graphql_query(query: str, token: Optional[str] = None) -> dict:
65+
# print(query)
6566
headers = {'Authorization': f'Bearer {token}'} if token else None
6667
request = requests.post(
6768
'https://api.github.com/graphql',
@@ -78,21 +79,25 @@ def query_contributions(
7879
authors: List[str],
7980
orgs: List[str],
8081
repos: List[str],
81-
since: datetime.date,
82+
since: Optional[datetime.date] = None,
8283
until: Optional[datetime.date] = None,
8384
) -> List[dict]:
84-
if until:
85-
date_range = f'{since.isoformat()}..{until.isoformat()}'
85+
if since is None and until is None:
86+
merged = ''
8687
else:
87-
date_range = f'>={since.isoformat()}'
88+
if until:
89+
date_range = f'{since.isoformat()}..{until.isoformat()}'
90+
else:
91+
date_range = f'>={since.isoformat()}'
92+
merged = f'merged:{date_range}'
8893

8994
search_query = ' '.join([
9095
'sort:updated-desc',
9196
'is:pr is:merged',
9297
' '.join([f'author:{a}' for a in authors]),
9398
' '.join([f'org:{o}' for o in orgs]),
9499
' '.join([f'repo:{r}' for r in repos]),
95-
f'merged:{date_range}',
100+
merged,
96101
])
97102

98103
cursor = 'null'

0 commit comments

Comments
 (0)