download-artifact
download-artifact copied to clipboard
support for "workflow_run" event triggers
the support for the newly introduced event "worgkflow_run" for github actions seams broken.
see my test environment: https://github.com/jkowalleck/playground_workflow_run
playground_workflow_run
playground for github event "worgkflow_run".
For example, if your
pull_request
workflow generates build artifacts, you can create a new workflow that usesworkflow_run
to analyze the results and add a comment to the original pull request.
The goal of tis playground is to see if downloading and processing artifacts in a "worgkflow_run" eent works as expected.
expectation
in a "worgkflow_run" triggered event i can download artifacts from the workflow that triggered the "worgkflow_run" trigger.
conclusion
the action "download-artifact" semas to be broken on event "worgkflow_run".
obeservations
- upload artifact in a "push"-event workflow works as expected.
- download artifact in the same "push"-event workflow works as expected.
- download artifact in a "worgkflow_run"-event workflow is broken.
- see action results.
how i tested
- action "TESTS" is triggered on push.
- it creates an artifact "reports".
- it downloads that exact sams artifact "reports".
- action "TESTS DONE" is triggered
after the action "TESTS" completed.
- it downloads that exact sams artifact "reports" from the "TESTS" action.
why i expected the download to word with "workflow_run" events:
- my workflow_run debug
- showed
github.event_name
as "workflow_run" - showed
github.event.workflow_run.artifacts_url
as "https://api.github.com/repos/jkowalleck/playground_workflow_run/actions/runs/220718887/artifact"
- showed
so i thought all needed info was available
I think I just encountered this. I have a pull_request
workflow that uploads the artifact, and as recommended by https://securitylab.github.com/research/github-actions-preventing-pwn-requests , I am using workflow_run
to download it, but I encountered this error:
Error: Unable to find any artifacts for the associated workflow
Luckily the article has code to download using github-script
, though it would have been so elegant to just use this action. I'll be interested to revisit this action when this is supported. Thank you!
Yeah, this not working properly is a major WTF. I mean come on, having to paste non-trivial code into my revision (from that blog post) is ridiculous. Especially since I'll have to repeat that in every repo...
Any progress on this?
https://github.com/actions/download-artifact#download-artifacts-from-other-workflow-runs-or-repositories does most of this, just doesn't automagically pass through the run-id
just doesn't automagically pass through the
run-id
Isn't that available?:
run_id: ${{ github.event.workflow_run.id }}
I haven't verified, but adapted the workflow from dawidd6/action-download-artifact@v3
to actions/download-artifact@v4
and expect that to work fine.
Yes. That indeed has worked for me @polarathene - One unexpected catch was needing to pass a github token with additional permissions, which is unexpected because the @dawidd6 action can get by without a PAT for accessing workflow run artifacts in the same repo.
One unexpected catch was needing to pass a github token with additional permissions, which is unexpected
Oh? In dawidd6/action-download-artifact@v3
I had provided the token as well as I think that was required for what I was doing 🤔 (PR branch workflow triggers a master branch workflow)
I did see the docs for actions/download-artifact@v4
state a workflow_run reference will require a token with access:read
permissions, which in my case (same repo, just different branches) that should be fine.
(PR branch workflow triggers a master branch workflow)
This is what I am using it for too, but I did not pass any token to action-download-artifact
e.g. https://github.com/matrix-org/matrix-react-sdk/commit/1dbcdfb6b29036798be348dc05fccda90121e66a yet ultimately had to specify a PAT to retain the same function using the 1st party action - https://github.com/matrix-org/matrix-react-sdk/commit/0d2253e7d04ba173e7d8d05b299404af93e92368