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

Wildcard support for deleting all artifacts #1

Closed
benstear opened this issue May 4, 2020 · 17 comments · Fixed by #10
Closed

Wildcard support for deleting all artifacts #1

benstear opened this issue May 4, 2020 · 17 comments · Fixed by #10

Comments

@benstear
Copy link

benstear commented May 4, 2020

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 :)

@GeekyEggo
Copy link
Owner

Great suggestion; I think adding wildcard support would be a great addition. I've got some free time this weekend so I'll see what I can do and keep you posted.

@benstear
Copy link
Author

benstear commented May 4, 2020

Awesome, thanks!

@LewisGaul
Copy link

+1 for this, would imagine you'd want to use @actions/glob as mentioned by @actions/upload-artifact?

@benstear
Copy link
Author

benstear commented Jul 5, 2020 via email

@GeekyEggo
Copy link
Owner

@LewisGaul I agree, using @actions/glob would be optimal; it appears that Pattern is only provided as an internal. Do you know of an example whereby the glob is being used as a pattern match, instead of file discovery?

@LewisGaul
Copy link

@GeekyEggo Hmm good point. I'm not very familiar with the setup with implementing github actions or with javascript/typescript, so not clear where an API for general glob pattern matching should be exposed from - seems reasonable that an API should perhaps be added to actions/glob?

A simpler alternative that would be just as good for me (and it sounds like it would for the OP too) would be to delete all artifacts for the workflow in the case that no name field was given. This wouldn't preclude from adding glob matching later on if desired. Thoughts?

@GeekyEggo
Copy link
Owner

GeekyEggo commented Jul 5, 2020

@benstear and @LewisGaul I've added support for glob pattern matching (utilising minimatch). It would be great if you could check if the changes fulfil your requirements by targeting the 1-glob-support branch via: geekyeggo/delete-artifact@1-glob-support

As the changes aren't breaking, and if you're happy with things, I'll update v1 this week.

@benstear
Copy link
Author

benstear commented Jul 6, 2020

@GeekyEggo works great for me, thanks very much for implementing this.

@LewisGaul
Copy link

LewisGaul commented Jul 6, 2020

@GeekyEggo I've tested it - I tried a few variants and all worked, including "*" to delete all artefacts.
I did come across one apparent regression: for some reason when specifying a glob expression with useGlob: false I got no warning saying that it wasn't found (and no artefacts were deleted as expected). See my equivalent runs with 1-glob-support compared to v1.

@GeekyEggo
Copy link
Owner

@LewisGaul you're right; this was a change to how artifacts are matched against supplied names. Previously names were iterated, and instead now artifacts are. This was primarily to prevent any duplicate attempts to remove artifacts that matched multiple globs. In hindsight, I may need to separate out the logic further to ensure the warning is still present when useGlob: false is the case.

@LewisGaul
Copy link

Makes sense, would definitely be good to keep that warning though. Thanks for working on it!

@GeekyEggo
Copy link
Owner

@LewisGaul the warning should now be present when useGlob: false (or not specified) again.

@LewisGaul
Copy link

Yep works for me!

There's no warning if nothing is matched with useGlob: true, but that's kind of a separate case which I'm not too bothered about (seems quite possible you might use "*" to delete everything and not care if there actually was anything to delete).

@moandor-y
Copy link

Hi @GeekyEggo , any plans to release this feature in a stable version? Our project could use this feature so it'll be really helpful to have a release with it.

@jonsimantov
Copy link

Hi @GeekyEggo , any plans to release this feature in a stable version? Our project could use this feature so it'll be really helpful to have a release with it.

Same question here - any plans to release this in a stable version?

@yonatanaftali
Copy link

yonatanaftali commented Dec 9, 2021

@GeekyEggo any update about this? It will help us a lot! :)

GeekyEggo added a commit that referenced this issue Oct 12, 2022
Fixes #1, closes #8, and bumps dependencies
@GeekyEggo
Copy link
Owner

GeekyEggo commented Oct 12, 2022

Hi all, apologies this has taken me so long; glob support is now available as part of v2, and is on by default. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants