-
Notifications
You must be signed in to change notification settings - Fork 694
Refactor collecting-PR script for release note #1951
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
Conversation
Looking at the code it is offending the bandit, it looks like the Before disabling the bandit, can you try changing the following commands into list of string? Line 35 in 184466a
Line 105 in 184466a
Line 111 in 184466a
|
The Lines 84 to 86 in 184466a
|
thanks for looking into and working on this! |
tools/retrieve_prs.py
Outdated
cmd = f"git log -n 1 --pretty=format:%s {commit_hash}" | ||
ret, out, err = run(cmd) | ||
return out if ret == 0 else None | ||
cmd = ['git', 'log', '-n', '1', f'--pretty=format:%s {commit_hash}'] |
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.
I think this is different from what it used to be.
cmd = ['git', 'log', '-n', '1', f'--pretty=format:%s {commit_hash}'] | |
cmd = ['git', 'log', '-n', '1', '--pretty=format:%s', f'{commit_hash}'] |
@nateanl Can you make a small PR for the part only related to |
tools/retrieve_prs.py
Outdated
@@ -1,13 +1,18 @@ | |||
"""Collect the PRs between the current and previous releases and |
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.
"""Collect the PRs between the current and previous releases and | |
"""Collect the PRs between two specified tags or commits and |
tools/retrieve_prs.py
Outdated
@@ -109,7 +109,10 @@ def get_commits_between(base_version, new_version): | |||
|
|||
|
|||
def _parse_args(args): |
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.
def _parse_args(args): | |
def _parse_args(args=None): |
return subprocess.check_output(cmd).strip() | ||
except Exception: | ||
return None | ||
return subprocess.check_output(cmd).decode('utf-8').strip() |
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.
Note: This would fail if the commit message is not encoded with utf-8
. (i.e. if user configures their git with non-uff commit message https://www.git-tower.com/help/guides/faq-and-tips/faq/encoding/windows)
The script needs to handle such case, while logging the failure and keep processing the rest of commits.
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.
- We need a way to detect the correct encoding from the result of
check_output
. - The for loop in the main function has to handle error properly and notify the user.
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 follow-up the case in the future PR.
refer to pytorch/vision#4626