Skip to content

Commit 9deee64

Browse files
committed
Add initial implementation of Vercel Blob Action with README, action.yml, and index.js
1 parent fec3683 commit 9deee64

4 files changed

Lines changed: 113 additions & 1 deletion

File tree

README.md

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,47 @@
1-
# vercel-blob-action
1+
# Vercel Blob Action
2+
3+
This GitHub Action allows you to interact with the Vercel Blob API by specifying a source and destination path. It is designed to facilitate the management of blobs in your Vercel projects.
4+
5+
## Inputs
6+
7+
- `source`: The source path of the blob you want to manage.
8+
- `destination`: The destination path where the blob should be moved or copied.
9+
10+
## Usage
11+
12+
To use this action in your workflow, you can include it as follows:
13+
14+
```yaml
15+
name: Example Workflow
16+
17+
on: [push]
18+
19+
jobs:
20+
upload_blob:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v2
25+
26+
- name: Upload Blob
27+
uses: your-username/vercel-blob-action@v1.0.0
28+
with:
29+
source: 'path/to/source'
30+
destination: 'path/to/destination'
31+
```
32+
33+
## Example
34+
35+
Here is an example of how to specify the source and destination paths:
36+
37+
```yaml
38+
- name: Upload Blob
39+
uses: your-username/vercel-blob-action@v1.0.0
40+
with:
41+
source: 'src/myBlob.txt'
42+
destination: 'dest/myBlob.txt'
43+
```
44+
45+
## License
46+
47+
This project is licensed under the ISC License.

action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: 'Vercel Blob Action'
2+
description: 'A GitHub Action to interact with Vercel Blob'
3+
inputs:
4+
source:
5+
description: 'The source path for the blob'
6+
required: true
7+
destination:
8+
description: 'The destination path for the blob'
9+
required: true
10+
runs:
11+
using: 'node12'
12+
main: 'src/index.js'
13+
branding:
14+
icon: 'cloud-upload'
15+
color: 'blue'

package.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"name": "vercel-blob-action",
3+
"version": "1.0.0",
4+
"description": "A GitHub Action for interacting with Vercel Blob storage.",
5+
"main": "src/index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [
10+
"github-action",
11+
"vercel",
12+
"blob"
13+
],
14+
"author": "",
15+
"license": "ISC",
16+
"dependencies": {
17+
"@actions/core": "^1.10.0",
18+
"@actions/github": "^5.0.0"
19+
}
20+
}

src/index.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const core = require('@actions/core');
2+
const axios = require('axios');
3+
4+
async function run() {
5+
try {
6+
const sourcePath = core.getInput('source');
7+
const destinationPath = core.getInput('destination');
8+
9+
if (!sourcePath || !destinationPath) {
10+
throw new Error('Both source and destination paths are required.');
11+
}
12+
13+
// Here you would add the logic to interact with the Vercel Blob API
14+
// For example, uploading a file from sourcePath to destinationPath
15+
16+
core.info(`Source Path: ${sourcePath}`);
17+
core.info(`Destination Path: ${destinationPath}`);
18+
19+
// Simulate API interaction
20+
const response = await axios.post('https://api.vercel.com/v1/blob', {
21+
source: sourcePath,
22+
destination: destinationPath
23+
});
24+
25+
core.setOutput('response', response.data);
26+
} catch (error) {
27+
core.setFailed(error.message);
28+
}
29+
}
30+
31+
run();

0 commit comments

Comments
 (0)