Skip to content

Commit

Permalink
*: initial scaffolding for the stickydisk action
Browse files Browse the repository at this point in the history
  • Loading branch information
adityamaru committed Dec 7, 2024
1 parent c27f005 commit 11d6fb1
Show file tree
Hide file tree
Showing 9 changed files with 27,895 additions and 23,035 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/basic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Basic Sticky Disk Test
on:
workflow_dispatch:
push:
pull_request:

jobs:
test-sticky-disk:
name: Test Sticky Disk
runs-on: blacksmith-staging
steps:
- name: Mount Sticky Disk
uses: useblacksmith/stickydisk@initial-commit
with:
key: foo
path: /shouldseethis

- name: List directory if exists
run: |
if [ -d "/shouldseethis" ]; then
ls -la /shouldseethis
fi
- name: Write test file
run: sudo sh -c 'echo "Hello from sticky disk" > /shouldseethis/test.txt'
77 changes: 2 additions & 75 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,3 @@
# Blacksmith Cache Delete Action
# Blacksmith Sticky Disk Action

A GitHub Action to delete caches from Blacksmith's cache storage. This action allows you to delete either a specific cache version or all versions of a cache key. This action only works Blacksmith runners.

## Usage

```yaml
- name: Delete Cache
uses: useblacksmith/cache-delete@v1
with:
key: Linux-composer-ecf6e2e236589e4d34ba89662b6bc2afe8e15237cd19a13df9dc0cb599ff4826
version: v213asda2cf # Optional: specific version to delete
```
## Inputs
| Input | Description | Required | Default |
| --------- | --------------------------------------- | -------- | ------- |
| `key` | The cache key to delete | No\* | - |
| `version` | Specific version of the cache to delete | No | - |
| `prefix` | Treat key as a prefix for bulk deletion | No | false |

\* Required unless `prefix` is true, in which case it can be empty to match all cache keys

## Examples

### Delete All Versions of a Cache

```yaml
- name: Delete All Cache Versions
uses: useblacksmith/cache-delete@v1
with:
key: npm-cache
```

### Delete a Specific Cache Version

```yaml
- name: Delete Specific Cache Version
uses: useblacksmith/cache-delete@v1
with:
key: npm-cache
version: v1.0
```

### Delete All Caches with a Prefix

```yaml
- name: Delete All npm Caches
uses: useblacksmith/cache-delete@v1
with:
key: npm-
prefix: true
```

### Delete All Caches

```yaml
- name: Delete All Caches
uses: useblacksmith/cache-delete@v1
with:
key: ""
prefix: true
```

## Error Handling

The action will:

- Fail if the cache deletion request fails (non-404 error)
- Log a message if the cache is not found (404)
- Successfully complete if the cache is deleted

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
TODO
20 changes: 8 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
name: "Delete Blacksmith Cache"
author: Aayush Shah
description: "Deletes a cache or specific cache version from Blacksmith"
name: "Blacksmith Sticky Disk"
author: Aditya Maru
description: "Creates a sticky disk on Blacksmith"
branding:
icon: folder-plus
color: black
inputs:
key:
description: "The cache key to delete"
required: false
version:
description: "Specific version of the cache to delete (optional)"
required: false
prefix:
description: "Treat key as a prefix for bulk deletion"
required: false
default: "false"
description: "A unique key to identify the sticky disk"
required: true
path:
description: "The path at which to mount the sticky disk"
required: true
runs:
using: "node20"
main: "dist/index.js"
Loading

0 comments on commit 11d6fb1

Please sign in to comment.