Skip to content

Commit 2167b03

Browse files
authored
[GHA] Don't update latest available artifacts link when copy failed (#26929)
This will make sure that "latest available" link is pointing to the complete set of artifacts
1 parent 2c6d1bb commit 2167b03

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

.github/actions/store_artifacts/store_artifacts.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@ def main():
9898
with open(storage / 'workflow_link.txt', 'w') as file:
9999
file.write(workflow_link)
100100

101-
latest_artifacts_for_branch = artifact_utils.get_latest_artifacts_link(storage_dir, args.storage_root,
102-
args.branch_name, args.event_name)
103-
# Overwrite path to "latest" built artifacts only if a given commit is the head of a given branch
104-
if args.event_name != 'pull_request' and args.commit_sha == os.getenv('GITHUB_SHA'):
105-
# TODO: lock to avoid corruption in case of a parallel build (unlikely event for now, but still)
106-
with open(latest_artifacts_for_branch, 'w') as file:
107-
file.write(str(storage.relative_to(storage_root)))
101+
if not error_found:
102+
latest_artifacts_for_branch = artifact_utils.get_latest_artifacts_link(storage_dir, args.storage_root,
103+
args.branch_name, args.event_name)
104+
# Overwrite path to "latest" built artifacts only if a given commit is the head of a given branch
105+
if args.event_name != 'pull_request' and args.commit_sha == os.getenv('GITHUB_SHA'):
106+
# TODO: lock to avoid corruption in case of a parallel build (unlikely event for now, but still)
107+
with open(latest_artifacts_for_branch, 'w') as file:
108+
file.write(str(storage.relative_to(storage_root)))
108109

109110
logger.debug(f"Copying finished")
110111
(storage / 'copying_finished').touch()

0 commit comments

Comments
 (0)