Skip to content

Commit

Permalink
add script get releases affected
Browse files Browse the repository at this point in the history
  • Loading branch information
orfeas-k committed Aug 10, 2023
1 parent 6f70824 commit 9a6276c
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/test.py
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()

0 comments on commit 9a6276c

Please sign in to comment.