Skip to content

Commit

Permalink
Add onlyPrefix and exceptPrefix arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
webbertakken committed Sep 28, 2020
1 parent 5c75c5d commit 3a62473
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,26 @@ jobs:
expire-in: 7days # Setting this to 0 will delete all artifacts
```
### Optional arguments
#### `onlyPrefix`

Only purge artifacts that start with `tmp_` as a prefix.

```yaml
with:
onlyPrefix: tmp_
```

#### `exceptPrefix`

Exclude any artifacts that start with `prod_` as a prefix

```yaml
with:
exceptPrefix: prod_
```

## Contributing

There are few improvements to be made, namely
Expand Down
8 changes: 8 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ inputs:
token:
required: true
description: 'Github auth token'
onlyPrefix:
required: false
description: 'Only artifacts with the specified prefix will be deleted'
default: ''
exceptPrefix:
required: false
description: 'Artifacts with this prefix will not be included for deletion'
default: ''
runs:
using: 'node12'
main: 'dist/index.js'
7 changes: 6 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ export async function* eachArtifact(

export interface IActionInputs {
expireInMs: number
onlyPrefix: string
exceptPrefix: string
}
export function getActionInputs(): IActionInputs {
const expireInHumanReadable = core.getInput('expire-in', { required: true })
const expireInMs = parseDuration(expireInHumanReadable)
return { expireInMs }
const onlyPrefix = core.getInput('onlyPrefix', { required: false })
const exceptPrefix = core.getInput('exceptPrefix', { required: false })

return { expireInMs, onlyPrefix, exceptPrefix }
}

0 comments on commit 3a62473

Please sign in to comment.