-
Notifications
You must be signed in to change notification settings - Fork 10
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
Create pr_commit_counts.py #44
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with comments :)
else: | ||
url = None | ||
else: | ||
raise Exception(f"GitHub API request failed with status code {response.status_code}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more of a for-the-future comment - we might want to think about better ways to handle an error than aborting entirely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will look at in the future
# organization = input("Enter the organization name: ") | ||
# github_token = input("Enter your GitHub access token: ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# organization = input("Enter the organization name: ") | |
# github_token = input("Enter your GitHub access token: ") | |
organization = input("Enter the organization name: ") |
The input option for the org name is fine, there's no security concern there. If you wanted to be fancy, you could allow an env var here too, and only request input if it's not set. It would probably look something like this:
organization = os.getenv("GITHUB_ORG")
if organization is None:
organization = input("Enter the organization name: ")
If you have a better style idea no problem, the main thing is to handle the options gracefully :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
# organization = input("Enter the organization name: ") | ||
# github_token = input("Enter your GitHub access token: ") | ||
|
||
organization = "ORGANIZATION_NAME" # Replace with your organization name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you make the change above, you can remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Added Readme file
@@ -16,27 +17,28 @@ def get_paginated_results(url, headers): | |||
raise Exception(f"GitHub API request failed with status code {response.status_code}") | |||
return results | |||
|
|||
def get_repos(organization, headers): | |||
def get_repos(BASE_URL, organization, headers): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm this wasn't quite what I meant - it makes more sense to just define BASE_URL as a constant in the file as you did, and use it everywhere - you don't have to make it an argument that you pass in.
New utility to allow customers to count total number of pull request events for all repos in a given GitHub org.