Skip to content
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

Delete Artifacts using @actions/artifact #380

Closed
konradpabjan opened this issue Mar 12, 2020 · 4 comments · Fixed by #1626
Closed

Delete Artifacts using @actions/artifact #380

konradpabjan opened this issue Mar 12, 2020 · 4 comments · Fixed by #1626
Labels
artifact enhancement New feature or request

Comments

@konradpabjan
Copy link
Contributor

konradpabjan commented Mar 12, 2020

It is currently possible to delete an artifact that is associated with a workflow run using the GitHub API: https://developer.github.com/v3/actions/artifacts/#delete-an-artifact

This API is limited though because an artifact is not available until after a run is complete

The @actions/artifact package should add a public deleteArtifact() method that will allow users to delete an artifact during a run

This will make it easier to support certain types types of scenarios such as retention

@bradennapier
Copy link

Agreed - additionally the artifacts using the lib are scoped to the workflow only so there are some other challenges . I wanted to make sure linting occurred when a forked PR was created and ended up needing to do some magic with the rest api directly to get it all working.

https://github.com/bradennapier/eslint-plus-action/blob/master/src/artifacts.ts

This type of application should be natively supported without question - especially since it solves the security problem, but it is also an example of how you can use the rest api for it. I have some extra pieces in there which may not be necessary but I haven't had a change to test without yet (I am deleting then remaking each time to make sure as I wasn't positive if it would overwrite if different workflows were creating them).

@robinxb
Copy link

robinxb commented Apr 12, 2022

+1 for deploying some artifacts when using other deployment. Now I have to sleep for few seconds to make this work.

@sefasenturk95
Copy link

When is this expected to be implemented?

@muzimuzhi
Copy link
Contributor

This API is limited though because an artifact is not available until after a run is complete

This limitation is removed in @actions/artifact@v2:

Improvements
[...]
2. Once uploaded, an Artifact ID is returned and Artifacts are immediately available in the UI and REST API. Previously, you would have to wait for the run to be completed before an ID was available or any APIs could be utilized.
3. Artifacts can now be downloaded and deleted from the UI before the entire workflow run finishes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
artifact enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants
@robinxb @sefasenturk95 @muzimuzhi @bradennapier @konradpabjan and others