-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
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,33 @@ | ||
# Extract from the files changed by this PR the channels/releases affected | ||
import re | ||
import sys | ||
import json | ||
|
||
def main() -> None: | ||
releases_affected = set() | ||
|
||
for file_path in sys.argv: | ||
pattern = "^releases" | ||
|
||
# check if string starts with the "releases" | ||
file_path_starts_with_releases = re.search(pattern, file_path) | ||
|
||
if file_path_starts_with_releases : | ||
directories = file_path.split('/') | ||
track = directories[1] | ||
risk = directories[2] | ||
accepted_tracks = ["1.4","1.6","1.7","latest"] | ||
accepted_risks = ["beta","edge","stable"] | ||
|
||
if(track in accepted_tracks and risk in accepted_risks): | ||
channel = f"{track}/{risk}" | ||
print(channel) | ||
releases_affected.add(channel) | ||
else: | ||
raise Exception(f"File {file_path} was changed in 'releases' directory but it's not part of a known release/channel.") | ||
|
||
releases_affected_json = json.dumps(list(releases_affected)) | ||
print(f"The following releases have been affected by this PR: {releases_affected_json}") | ||
print(f'::set-output name=releases_affected_json::{releases_affected_json}') | ||
|
||
main() |