-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rely on gh run download to extract the artifacts #3591
Rely on gh run download to extract the artifacts #3591
Conversation
Turns out gh already unpacks the artifact so the unzip steps are no longer needed. This also means we need multiple indivual commands because they need to be extract to different directories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sane. Let's try it out.
mkdir -p preview/${{ fromJSON(env.PR_DATA).target_name }} | ||
unzip -d preview foreman-docs-web-master.zip | ||
unzip -d preview/${{ fromJSON(env.PR_DATA).target_name }} foreman-docs-html-${{ fromJSON(env.PR_DATA).branch_name }}.zip | ||
gh run download '${{ github.event.worfklow_run.id }}' --name 'foreman-docs-web-master' --dir preview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to a merge conflict, Worf is back. Surprisingly, https://github.com/theforeman/foreman-documentation/actions/runs/12831182509/job/35780996640 passed:
gh run download '' --name 'foreman-docs-web-master' --dir preview
The preview and diff look correct so perhaps the workflow ID is not needed at all and it's smart enough to detect it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Answering my own question from man gh-run-download
:
By default, this command downloads the latest artifact created and uploaded through GitHub Actions. Because workflows can delete or overwrite artifacts, must be used to select an artifact from a specific workflow run.
So it worked because it was the last run, but that's not guaranteed to be correct. #3593 should address this.
Overall I think this is now almost done, even though it was bumpy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this is a good sign to me: #3592 (comment)
So yes, we should either fix the typo and ignore that it's not really necessary or drop it?
In 078bc30 I reintroduced a typo in the variable because of a merge conflict, making it end up as an empty string again. It happened to work because it was the last run (default behavior) but there's no guarantee this is correct. Fixes: 078bc30 ("Rely on gh run download to extract the artifacts (theforeman#3591)")
In 078bc30 I reintroduced a typo in the variable because of a merge conflict, making it end up as an empty string again. It happened to work because it was the last run (default behavior) but there's no guarantee this is correct. Fixes: 078bc30 ("Rely on gh run download to extract the artifacts (#3591)")
What changes are you introducing?
Turns out gh already unpacks the artifact so the unzip steps are no longer needed. This also means we need multiple indivual commands because they need to be extract to different directories.
Why are you introducing these changes? (Explanation, links to references, issues, etc.)
#3588 (comment)
Anything else to add? (Considerations, potential downsides, alternative solutions you have explored, etc.)
I promise I'm trying to make things easier ;)
I also verified I can download manually:
Checklists
Please cherry-pick my commits into: