geekyeggo / delete-artifact Goto Github PK
View Code? Open in Web Editor NEWA GitHub Action to deletes artifacts within the workflow run.
License: MIT License
A GitHub Action to deletes artifacts within the workflow run.
License: MIT License
Specifically, I would like to remove temporary artifacts that are required for triggered workflows like the event file described here https://github.com/EnricoMi/publish-unit-test-result-action#support-fork-repositories-and-dependabot-branches
The Readme says
Support for actions/upload-artifact@v4 utilizes the GitHub REST API, and requires a permissive GITHUB_TOKEN ...
I'm assuming from GITHUB_TOKEN
(environment variable) and from the current implementation that the token should be read automatically.
The most likely reason it is not however, is that the token is both required and has default
set:
Lines 9 to 10 in 3f83cd6
I ran into this recently in hashicorp/terraform-ls#1582
Even after adding the following to the workflow
permissions:
actions: write
I was still getting the following error:
Error: Error: Parameter token or opts.auth is required
(which also happened to be ignored due to #20)
https://github.com/hashicorp/terraform-ls/actions/runs/7531206486/job/20499481014#step:2:9
It seems that this action fails with "Resource not accessible by integration" when trying to delete an artifact created in the same workflow in a pull request context.
Do you know if there is a way to delete the artifact in this context ?
Example: https://github.com/WerWolv/ImHex/actions/runs/8344907183/job/22838673123?pr=1601#step:3:11
Example:
- uses: geekyeggo/delete-artifact@2
with:
name: "**"
Context:
I am currently reworking a workflow to use with the v4 versions of upload/download-artifact and was relying heavily on adding content to artifacts before. So I settled for creating lots of unique little artifacts and combining them for the user at the very end of my workflow, where I use those tiny bits to generate a couple of reports. I use download-artifact to download all artifacts matching the pattern "testplan-", then I generate some reports from all the snippets and combine everything into an artifact "testplan". Afterwards, I want to delete everything matching "testplan-" to clean up.
Problem:
Some but not all artifacts matching the pattern are deleted. Example:
Run actions/download-artifact@v4
with:
pattern: testplan-*
merge-multiple: true
downloads 32 artifacts, matching the various matrix runs. The subsequent
Run geekyeggo/delete-artifact@v4
with:
name: testplan-*
useGlob: true
failOnError: false
then deletes 18 of them, leaving the rest to dry. Do you have any idea, why this is happening?
The disclaimer in your README states that this is using a preview version of GitHub's runtime API which is subject to change. I looked through the GitHub API docs but I didn't see anything there about the API being a preview or being unstable.
Am I just looking in the wrong place, or is the disclaimer incorrect?
The Readme mentions:
By default, the action will fail when it was not possible to delete an artifact (with the exception of name mismatches).
This is not a behaviour we have recently observed:
https://github.com/hashicorp/terraform-ls/actions/runs/7531206486/job/20499481014#step:2:9
Run geekyeggo/delete-artifact@9d15d164b1dcd538ff1b1a2984bc2c0240986c3b
with:
name: provider-schema-data
useGlob: true
failOnError: true
env:
PKG_NAME: terraform-ls
Error: Error: Parameter token or opts.auth is required
Assuming the intentions match with the documentation then I'd assume this is a bug.
Here is a full workflow definition: https://github.com/hashicorp/terraform-ls/blob/623f35c5a3019aa8c8a19fe067266b90095dc02e/.github/workflows/build.yml#L169-L175
I ran into this recently in hashicorp/terraform-ls#1580 when I did not realise that the new v4 version requires some additional permissions and I realised later it failed silently.
Hey There,
I'm facing a weird issue while using the action
- name: Delete Build artifacts
if: "!!steps.release.outputs.version"
uses: geekyeggo/delete-artifact@v1
with:
name: |
webhooks
graphql
So in my CI.yml file I've this code snippet, which seems to work cause when I check the Artifacts section inside my Github Action, I don't see those artifacts. However, If I make a call to /repos/{owner}/{repo}/actions/artifacts
I can still them listed there.
is there anything we could do about that? or is it how Github Actions Artifacts works?
An example workflow: https://github.com/muzimuzhi/hello-github-actions/actions/runs/7256001370
More comparisons can be found in muzimuzhi/hello-github-actions#24. It seems changes more than a naive package upgrading are needed (I'm not a front-end developer). Also the listArtifacts()
function from @actions/artifact
might be helpful.
Several breaking changes were introduced in actions/upload-artifact@v4
, see
See
It seems to me then implementation in current repo could be simplified, once @actions/artifact
ships a new release.
Is there a way to delete all artifacts, regardless of their name(s)? The names of my artifacts vary, so this would be a nice feature :)
Warning given at the workflow:
"Node.js 12 actions are deprecated. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/. Please update the following actions to use Node.js 16: geekyeggo/delete-artifact"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.