Closed benstear closed 2 years ago
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.
Awesome, thanks!
+1 for this, would imagine you'd want to use @actions/glob as mentioned by @actions/upload-artifact?
Yes, that would be perfect! My CI workflow generates artifacts named by according to which previous jobs have passed,. I need them for the next job, but I'd like to delete them all at the end of the workflow. The wildcard feature would make this super easy.
From: Lewis Gaul notifications@github.com Sent: Saturday, July 4, 2020 8:11 PM To: GeekyEggo/delete-artifact delete-artifact@noreply.github.com Cc: Stear,Benjamin bjs385@dragons.drexel.edu; Author author@noreply.github.com Subject: Re: [GeekyEggo/delete-artifact] Wildcard support for deleting all artifacts (#1)
External.
+1 for this, would imagine you'd want to use @actions/globhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Factions%2Ftoolkit%2Ftree%2Fmaster%2Fpackages%2Fglob&data=02%7C01%7Cbjs385%40dragons.drexel.edu%7C42d2d31baa794a664fef08d8207804ef%7C3664e6fa47bd45a696708c4f080f8ca6%7C0%7C0%7C637295047159831598&sdata=6wdW83Jyaboy8uPC%2F0LFYqM4zNfE1Bc2Oi6xQiNjrOY%3D&reserved=0 as mentioned by @actions/upload-artifacthttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Factions%2Fupload-artifact&data=02%7C01%7Cbjs385%40dragons.drexel.edu%7C42d2d31baa794a664fef08d8207804ef%7C3664e6fa47bd45a696708c4f080f8ca6%7C0%7C0%7C637295047159831598&sdata=YBttL%2F27HUut1CTVy8RvZYL%2FTVXasbXR1LIgQyad1fk%3D&reserved=0?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FGeekyEggo%2Fdelete-artifact%2Fissues%2F1%23issuecomment-653825458&data=02%7C01%7Cbjs385%40dragons.drexel.edu%7C42d2d31baa794a664fef08d8207804ef%7C3664e6fa47bd45a696708c4f080f8ca6%7C0%7C0%7C637295047159841591&sdata=mdkz1xDAvhpdkAnWeC54v0NaA9ghwenUA8JKw9WNrTo%3D&reserved=0, or unsubscribehttps://nam01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAI7NJHNFSE66W2SPLGIYPP3RZ7AMPANCNFSM4MYYPZ5Q&data=02%7C01%7Cbjs385%40dragons.drexel.edu%7C42d2d31baa794a664fef08d8207804ef%7C3664e6fa47bd45a696708c4f080f8ca6%7C0%7C0%7C637295047159841591&sdata=%2FjGnvKasuoc6NybQldqlauVVzi5bHRXne4HDAExxRJI%3D&reserved=0.
@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?
@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?
@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.
@GeekyEggo works great for me, thanks very much for implementing this.
@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.
@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.
Makes sense, would definitely be good to keep that warning though. Thanks for working on it!
@LewisGaul the warning should now be present when useGlob: false
(or not specified) again.
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).
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.
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?
@GeekyEggo any update about this? It will help us a lot! :)
Hi all, apologies this has taken me so long; glob support is now available as part of v2, and is on by default. 🙂
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 :)