Skip to content

Commit

Permalink
Add glob support, switch to TypeScript, and bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
GeekyEggo committed Oct 12, 2022
1 parent 442f120 commit 424f35a
Show file tree
Hide file tree
Showing 14 changed files with 5,542 additions and 1,668 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI
# an example workflow that also monitors success of the preview api

on:
push:
branches:
- master

schedule:
- cron: '0 */6 * * *'
# every 6 hours

defaults:
run:
shell: bash

jobs:
test:
runs-on: windows-latest

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Create test file
run: echo hello > world.txt

- uses: actions/upload-artifact@v2
with:
name: my-artifact
path: world.txt

- uses: actions/upload-artifact@v2
with:
name: my-artifact-2
path: world.txt

- uses: actions/upload-artifact@v2
with:
name: my-artifact-3
path: world.txt

- uses: actions/upload-artifact@v2
with:
name: you-artifact
path: world.txt

- name: Delete (specific, glob disabled)
uses: ./
with:
name: my-artifact
useGlob: false

- name: Delete (pattern, glob enabled)
uses: ./
with:
name: my-*

- name: Delete (specific, glob enabled)
uses: ./
with:
name: you-artifact
27 changes: 0 additions & 27 deletions .github/workflows/example.yml

This file was deleted.

59 changes: 33 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,57 @@
![Example](https://github.com/GeekyEggo/delete-artifact/workflows/CI/badge.svg)

# Delete artifacts

A GitHub Action for deleting artifacts within the workflow run. This can be useful when artifacts are shared across jobs, but are no longer needed when the workflow is complete.

## Usage
## ⚡ Usage

See [action.yml](action.yml)

### Delete an individual artifact

```yml
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2

- run: echo hello > world.txt
- run: echo hello > world.txt

- uses: actions/upload-artifact@v1
with:
name: my-artifact
path: world.txt
- uses: actions/upload-artifact@v2
with:
name: my-artifact
path: world.txt

# delete-artifact
- uses: geekyeggo/delete-artifact@v1
with:
name: my-artifact
# delete-artifact
- uses: geekyeggo/delete-artifact@v2
with:
name: my-artifact
```
## Multiple artifacts
### Specify multiple names
Deleting multiple artifacts within a single action can be achieved by specifying each artifact name on a new line; this can improve performance when deleting more than one artifact.
```yml
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: |
artifact-one
artifact-two
artifact-three
- uses: geekyeggo/delete-artifact@2
with:
name: |
artifact-*
binary-file
output
```
## Error vs Fail
## 🚨 Error vs Fail
By default, the action will fail when it was not possible to delete an artifact (with the exception of name mismatches). When the deletion of an artifact is not integral to the success of a workflow, it is possible to error without failure. All errors are logged.
```yml
steps:
- uses: geekyeggo/delete-artifact@v1
with:
name: okay-to-keep
failOnError: false
- uses: geekyeggo/delete-artifact@v2
with:
name: okay-to-keep
failOnError: false
```
## ⚠ Disclaimer
## Disclaimer
This action utilizes a preview version of GitHub's runtime API; the API is subject to change at any time which may result in failures of this action.
Loading

0 comments on commit 424f35a

Please sign in to comment.