Skip to content

Commit

Permalink
Make since optional in contrib report
Browse files Browse the repository at this point in the history
Signed-off-by: Emerson Knapp <[email protected]>
  • Loading branch information
Emerson Knapp committed Sep 25, 2021
1 parent 611247e commit 41144da
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions ros_github_scripts/generate_contribution_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@


def graphql_query(query: str, token: Optional[str] = None) -> dict:
# print(query)
headers = {'Authorization': f'Bearer {token}'} if token else None
request = requests.post(
'https://api.github.com/graphql',
Expand All @@ -78,21 +79,25 @@ def query_contributions(
authors: List[str],
orgs: List[str],
repos: List[str],
since: datetime.date,
since: Optional[datetime.date] = None,
until: Optional[datetime.date] = None,
) -> List[dict]:
if until:
date_range = f'{since.isoformat()}..{until.isoformat()}'
if since is None and until is None:
merged = ''
else:
date_range = f'>={since.isoformat()}'
if until:
date_range = f'{since.isoformat()}..{until.isoformat()}'
else:
date_range = f'>={since.isoformat()}'
merged = f'merged:{date_range}'

search_query = ' '.join([
'sort:updated-desc',
'is:pr is:merged',
' '.join([f'author:{a}' for a in authors]),
' '.join([f'org:{o}' for o in orgs]),
' '.join([f'repo:{r}' for r in repos]),
f'merged:{date_range}',
merged,
])

cursor = 'null'
Expand Down

0 comments on commit 41144da

Please sign in to comment.