Skip to content

Commit

Permalink
Output empty json if version not provided to release matrix (#4742)
Browse files Browse the repository at this point in the history
For release matrix generation. Allow empty version as input.
  • Loading branch information
atalman authored Nov 16, 2023
1 parent da280fe commit 32bcfef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/generate_release_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
version:
description: "Release matrix for pytorch release version"
default: "2.1.1"
default: ""
type: string
test-infra-repository:
description: "Test infra repository to use"
Expand Down
11 changes: 6 additions & 5 deletions tools/scripts/generate_release_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,16 @@ def main(args) -> None:
"--version",
help="PyTorch Release version",
type=str,
default=os.getenv("VERSION", "2.1.1"),
default=os.getenv("VERSION", ""),
)

options = parser.parse_args(args)

if options.version not in RELEASE_DICT.keys():
if options.version and options.version not in RELEASE_DICT.keys():
raise ValueError(f"{options.version} is not a valid release")

print(json.dumps(RELEASE_DICT[options.version]))
elif options.version:
print(json.dumps(RELEASE_DICT[options.version]))
else:
print(json.dumps({}))


if __name__ == "__main__":
Expand Down

0 comments on commit 32bcfef

Please sign in to comment.