korgmatose
korgmatose

Reputation: 265

Share workflow artifacts between workflow runs / github actions using the API

As per Share artifacts between workflows / Github Actions , the API is now available for retrieval of the artifacts, but how would you use this in a real world scenario?

Our business case is that we run a deploy to test - workflow that also persists the artifact for the current workflow, since this is using different jobs in the workflow.

Our goal is then to re-use this artifact if the test is OK, thus promoting it to production rather than re-building the code.

The API allows for download of run artifacts, but our concern is that we are struggling to find an elegant way to pass the run/artifact id from the original workflow to the one that handles the actual deploy.

Upvotes: 2

Views: 4167

Answers (1)

korgmatose
korgmatose

Reputation: 265

I solved this by using a custom action:

https://github.com/marketplace/actions/download-workflow-artifact

I had already used the original commit hash for the initial build action, so re-using it here based on triggers for the same commit was relatively straight forward.

Upvotes: 1

Related Questions