Skip to content

Commit bcdf8c5

Browse files
authored
Merge pull request #4 from runloopai/jrvb-misc-fixes
Add version to examples, plus other small fixes
2 parents 30f9a38 + c00f201 commit bcdf8c5

9 files changed

Lines changed: 28 additions & 21 deletions

File tree

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ A GitHub Action to deploy agents to the [Runloop](https://runloop.ai) platform.
1414

1515
## Quick Start
1616

17-
### Deploy Current Repository as Agent
17+
### Deploy Current Repository as an Agent
1818

1919
```yaml
2020
- name: Deploy agent
2121
uses: runloopai/deploy-agent@main
2222
with:
2323
api-key: ${{ secrets.RUNLOOP_API_KEY }}
2424
source-type: git
25+
agent-version: 1.0.0
2526
```
2627
2728
That's it! The action will automatically use your current repository and commit SHA.
@@ -34,6 +35,7 @@ That's it! The action will automatically use your current repository and commit
3435
|-------|----------|---------|-------------|
3536
| `api-key` | ✅ | | Runloop API key (store in secrets) |
3637
| `source-type` | ✅ | | Agent source type: `git`, `tar`, or `file` |
38+
| `agent-version` | ✅ | | Agent version (semver string like `2.0.65` or git SHA) |
3739
| `agent-name` | | repo name | Name for the agent (defaults to repository name) |
3840
| `git-repository` | | current repo | Git repository URL (auto-detected) |
3941
| `git-ref` | | current commit/tag | Git ref (branch/tag/commit SHA, auto-detected) |
@@ -63,6 +65,7 @@ That's it! The action will automatically use your current repository and commit
6365
with:
6466
api-key: ${{ secrets.RUNLOOP_API_KEY }}
6567
source-type: git
68+
agent-version: 1.0.0
6669
setup-commands: |
6770
chmod +x scripts/agent.sh
6871
npm install
@@ -84,6 +87,7 @@ jobs:
8487
with:
8588
api-key: ${{ secrets.RUNLOOP_API_KEY }}
8689
source-type: git
90+
agent-version: ${{ github.event.release.tag_name }}
8791
agent-name: my-agent-${{ github.event.release.tag_name }}
8892
```
8993

@@ -105,6 +109,7 @@ Basic example:
105109
with:
106110
api-key: ${{ secrets.RUNLOOP_API_KEY }}
107111
source-type: tar
112+
agent-version: 1.0.0
108113
path: agent.tar.gz
109114
object-ttl-days: 30
110115
```
@@ -123,6 +128,7 @@ You can also use `.tar` format or reference output from a previous step:
123128
with:
124129
api-key: ${{ secrets.RUNLOOP_API_KEY }}
125130
source-type: tar
131+
agent-version: 1.0.0
126132
path: ${{ steps.build.outputs.archive-path }}
127133
```
128134

@@ -133,6 +139,7 @@ You can also use `.tar` format or reference output from a previous step:
133139
with:
134140
api-key: ${{ secrets.RUNLOOP_API_KEY }}
135141
source-type: file
142+
agent-version: 1.0.0
136143
path: ./scripts/agent.sh
137144
```
138145

action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ inputs:
5656
object-ttl-days:
5757
description: 'Time-to-live for uploaded objects in days (optional)'
5858
required: false
59+
# default is 'undefined' => don't auto-delete
5960

6061
outputs:
6162
agent-id:

dist/index.js

Lines changed: 5 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/git-auto.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
with:
2121
api-key: ${{ secrets.RUNLOOP_API_KEY }}
2222
source-type: git
23+
agent-version: 1.0.0
2324
# agent-name defaults to repository name if not provided
2425
# git-repository defaults to current repository
2526
# git-ref defaults to current commit SHA

examples/git-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
with:
2121
api-key: ${{ secrets.RUNLOOP_API_KEY }}
2222
source-type: git
23+
agent-version: ${{ github.event.release.tag_name }}
2324
agent-name: my-agent-${{ github.event.release.tag_name }}
2425
# git-ref automatically uses the release tag
2526
setup-commands: |

examples/single-file.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
with:
2424
api-key: ${{ secrets.RUNLOOP_API_KEY }}
2525
source-type: file
26+
agent-version: 1.0.0
2627
agent-name: my-script-agent
2728
path: ./scripts/agent.sh # Path to single file
2829
setup-commands: |

examples/tar-agent.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
with:
4646
api-key: ${{ secrets.RUNLOOP_API_KEY }}
4747
source-type: tar
48+
agent-version: 1.0.0
4849
path: agent.tar.gz
4950
agent-name: my-tar-agent
5051
setup-commands: |
@@ -82,6 +83,7 @@ jobs:
8283
with:
8384
api-key: ${{ secrets.RUNLOOP_API_KEY }}
8485
source-type: tar
86+
agent-version: ${{ steps.build.outputs.agent-version }}
8587
path: ${{ steps.build.outputs.archive-path }}
8688
agent-name: built-agent-${{ steps.build.outputs.agent-version }}
8789

@@ -102,6 +104,7 @@ jobs:
102104
with:
103105
api-key: ${{ secrets.RUNLOOP_API_KEY }}
104106
source-type: tar
107+
agent-version: 1.0.0
105108
path: agent.tar
106109

107110
deploy-with-exclusions:
@@ -128,6 +131,7 @@ jobs:
128131
with:
129132
api-key: ${{ secrets.RUNLOOP_API_KEY }}
130133
source-type: tar
134+
agent-version: 1.0.0
131135
path: agent.tar.gz
132136
object-ttl-days: 30
133137
is-public: false
@@ -150,4 +154,5 @@ jobs:
150154
with:
151155
api-key: ${{ secrets.RUNLOOP_API_KEY }}
152156
source-type: tar
157+
agent-version: 1.0.0
153158
path: ./artifacts/agent.tar.gz

src/validators.ts

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,11 @@ export function validateInputs(inputs: ActionInputs): void {
9595
}
9696

9797
function validatePath(inputPath: string, sourceType: SourceType): void {
98-
// Resolve path relative to workspace
99-
const workspace = process.env.GITHUB_WORKSPACE;
100-
if (!workspace) {
101-
throw new Error('GITHUB_WORKSPACE environment variable is not set');
98+
if (sourceType !== 'file' && sourceType !== 'tar') {
99+
throw new Error(`validatePath is undefined when source-type is "${sourceType}": ${inputPath}`);
102100
}
103101

104-
const absolutePath = path.isAbsolute(inputPath) ? inputPath : path.join(workspace, inputPath);
102+
const absolutePath = resolvePath(inputPath);
105103

106104
// Check if path exists
107105
if (!fs.existsSync(absolutePath)) {
@@ -110,11 +108,8 @@ function validatePath(inputPath: string, sourceType: SourceType): void {
110108

111109
// Validate based on source type
112110
const stats = fs.statSync(absolutePath);
113-
114-
if (sourceType === 'file' || sourceType === 'tar') {
115-
if (!stats.isFile()) {
116-
throw new Error(`Path must be a file when source-type is "${sourceType}": ${inputPath}`);
117-
}
111+
if (!stats.isFile()) {
112+
throw new Error(`Path must be a file when source-type is "${sourceType}": ${inputPath}`);
118113
}
119114
}
120115

0 commit comments

Comments
 (0)