mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Pass in repo args now that they're required (after a recent refactor). Also changes the script to pass in the repo name instead of being hardcoded to pytorch/pytorch. I'm guessing this wasn't noticed earlier since the workflow is only triggered when a label is created/edited/deleted Pull Request resolved: https://github.com/pytorch/pytorch/pull/95227 Approved by: https://github.com/huydhn
39 lines
1.1 KiB
Python
Executable File
39 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
'''
|
|
Test ownership was introduced in https://github.com/pytorch/pytorch/issues/66232.
|
|
|
|
As a part of enforcing test ownership, we want to maintain a list of existing PyTorch labels
|
|
to verify the owners' existence. This script outputs a file containing a list of existing
|
|
pytorch/pytorch labels so that the file could be uploaded to S3.
|
|
|
|
This script assumes the correct env vars are set for AWS permissions.
|
|
|
|
'''
|
|
|
|
import boto3 # type: ignore[import]
|
|
import json
|
|
|
|
from label_utils import gh_get_labels
|
|
from typing import Any
|
|
|
|
|
|
def parse_args() -> Any:
|
|
from argparse import ArgumentParser
|
|
parser = ArgumentParser("Export PR labels")
|
|
parser.add_argument("org", type=str)
|
|
parser.add_argument("repo", type=str)
|
|
|
|
return parser.parse_args()
|
|
|
|
|
|
def main() -> None:
|
|
args = parse_args()
|
|
print(f"Exporting labels for {args.org}/{args.repo}")
|
|
labels_file_name = "pytorch_labels.json"
|
|
obj = boto3.resource('s3').Object('ossci-metrics', labels_file_name)
|
|
obj.put(Body=json.dumps(gh_get_labels(args.org, args.repo)).encode())
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|