Provide the action url instead of the artifact url.

This commit is contained in:
Benoit Marty 2024-05-21 16:05:04 +02:00 committed by Benoit Marty
parent aa71b9fd03
commit 1e3455820e
3 changed files with 160 additions and 31 deletions

View file

@ -71,15 +71,27 @@ if args.verbose:
# Ex: https://github.com/element-hq/element-x-android/actions/runs/7299827320/artifacts/1131077517
artifactUrl = args.artifactUrl
url_regex = r"https://github.com/(.+?)/(.+?)/actions/runs/.+?/artifacts/(.+)"
result = re.search(url_regex, artifactUrl)
# if artifactUrl starts with https://github.com
if artifactUrl.startswith('https://github.com'):
url_regex = r"https://github.com/(.+?)/(.+?)/actions/runs/.+?/artifacts/(.+)"
result = re.search(url_regex, artifactUrl)
if result is None:
print(
"❌ Invalid parameter --artifactUrl '%s'. Please check the format.\nIt should be something like: %s" %
(artifactUrl, 'https://github.com/element-hq/element-x-android/actions/runs/7299827320/artifacts/1131077517')
)
exit(1)
else:
url_regex = r"https://api.github.com/repos/(.+?)/(.+?)/actions/artifacts/(.+)"
result = re.search(url_regex, artifactUrl)
if result is None:
print(
"❌ Invalid parameter --artifactUrl '%s'. Please check the format.\nIt should be something like: %s" %
(artifactUrl, 'https://api.github.com/repos/element-hq/element-x-android/actions/artifacts/1131077517')
)
exit(1)
if result is None:
print(
"❌ Invalid parameter --artifactUrl '%s'. Please check the format.\nIt should be something like: %s" %
(artifactUrl, 'https://github.com/element-hq/element-x-android/actions/runs/7299827320/artifacts/1131077517')
)
exit(1)
(gitHubRepoOwner, gitHubRepo, artifactId) = result.groups()