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, node 16, TypeScript, and dependency bump #10

Merged
merged 3 commits into from Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
@@ -0,0 +1,12 @@
root = true

[*]
charset = utf-8
insert_final_newline = true
end_of_line = crlf
indent_style = space
indent_size = 4

[{.yml}]
indent_style = space
indent_size = 2
63 changes: 63 additions & 0 deletions .github/workflows/ci.yml
@@ -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.

2 changes: 1 addition & 1 deletion .gitignore
@@ -1,2 +1,2 @@
# Dependency directories
node_modules/
node_modules
59 changes: 33 additions & 26 deletions README.md
@@ -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.

8 changes: 6 additions & 2 deletions action.yml
Expand Up @@ -4,12 +4,16 @@ inputs:
name:
description: The name of the artifact to delete; multiple names can be supplied on new lines.
required: true
useGlob:
description: Indicates whether the name, or names, should be treated as glob patterns.
required: false
default: 'true'
failOnError:
description: Indicates whether the action should fail upon encountering an error.
required: false
default: true
default: 'true'
runs:
using: node12
using: node16
main: ./dist/index.js
branding:
icon: trash-2
Expand Down