-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into core/adding-kernel-library-list
- Loading branch information
Showing
9,383 changed files
with
2,124,953 additions
and
410,664 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import json | ||
import subprocess | ||
from os import environ | ||
|
||
|
||
def get_files_changed_in_pr(pr_number: int) -> list[str]: | ||
# from: https://stackoverflow.com/questions/25071579/list-all-files-changed-in-a-pull-request-in-git-github | ||
|
||
modified_files: list[str] = [] | ||
|
||
try: | ||
process_output: str = subprocess.run( | ||
[ | ||
"gh", | ||
"pr", | ||
"view", | ||
str(pr_number), | ||
"--json", | ||
"files", | ||
"--jq", | ||
".files.[].path", | ||
], | ||
check=True, | ||
capture_output=True, | ||
text=True, | ||
).stdout | ||
|
||
modified_files = process_output.splitlines() | ||
|
||
except Exception as e: | ||
print(f"An error occured while getting the modified files: {e}") | ||
|
||
return modified_files | ||
|
||
|
||
if __name__ == "__main__": | ||
assert "GITHUB_TOKEN" in environ, 'missing environment variable "GITHUB_TOKEN"!' | ||
assert "GITHUB_PR_NUMBER" in environ, 'missing environment variable "GITHUB_PR_NUMBER"!' | ||
|
||
pr_number: int = int(environ["GITHUB_PR_NUMBER"]) | ||
modified_files = get_files_changed_in_pr(pr_number) | ||
|
||
print(json.dumps(modified_files)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.