Skip to content

Commit fad85b6

Browse files
jason-rlclaude
andcommitted
feat: make agent-version optional, clarify npm/pip pinning behavior
Make agent-version optional for all source types. Update description to clarify that for npm/pip agents it pins the installed package version, and is not used for git or object agents. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e08d389 commit fad85b6

5 files changed

Lines changed: 26 additions & 22 deletions

File tree

action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ inputs:
2121
required: false
2222

2323
agent-version:
24-
description: 'The version of the Agent. Must be a semver string (e.g., "2.0.65") or a SHA.'
25-
required: true
24+
description: 'For npm/pip agents, pins the installed package version (e.g., "2.0.65"). Not used for git or object agents. Must be a semver string or SHA when provided.'
25+
required: false
2626

2727
# Git source inputs
2828
git-repository:

dist/index.js

Lines changed: 11 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.

src/agent-deployer.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ async function deployGitAgent(
9090
const agent = await client.api.post<unknown, AgentResponse>('/v1/agents', {
9191
body: {
9292
name: agentName,
93-
version: inputs.agentVersion,
93+
...(inputs.agentVersion && { version: inputs.agentVersion }),
9494
...(inputs.isPublic !== undefined && { is_public: inputs.isPublic }),
9595
source: {
9696
type: 'git',
@@ -139,7 +139,7 @@ async function deployTarAgent(
139139
const agent = await client.api.post<unknown, AgentResponse>('/v1/agents', {
140140
body: {
141141
name: agentName,
142-
version: inputs.agentVersion,
142+
...(inputs.agentVersion && { version: inputs.agentVersion }),
143143
...(inputs.isPublic !== undefined && { is_public: inputs.isPublic }),
144144
source: {
145145
type: 'object',
@@ -188,7 +188,7 @@ async function deployFileAgent(
188188
const agent = await client.api.post<unknown, AgentResponse>('/v1/agents', {
189189
body: {
190190
name: agentName,
191-
version: inputs.agentVersion,
191+
...(inputs.agentVersion && { version: inputs.agentVersion }),
192192
...(inputs.isPublic !== undefined && { is_public: inputs.isPublic }),
193193
source: {
194194
type: 'object',
@@ -234,7 +234,7 @@ async function deployNpmAgent(
234234
const agent = await client.api.post<unknown, AgentResponse>('/v1/agents', {
235235
body: {
236236
name: agentName,
237-
version: inputs.agentVersion,
237+
...(inputs.agentVersion && { version: inputs.agentVersion }),
238238
...(inputs.isPublic !== undefined && { is_public: inputs.isPublic }),
239239
source: {
240240
type: 'npm',
@@ -276,7 +276,7 @@ async function deployPipAgent(
276276
const agent = await client.api.post<unknown, AgentResponse>('/v1/agents', {
277277
body: {
278278
name: agentName,
279-
version: inputs.agentVersion,
279+
...(inputs.agentVersion && { version: inputs.agentVersion }),
280280
...(inputs.isPublic !== undefined && { is_public: inputs.isPublic }),
281281
source: {
282282
type: 'pip',

src/validators.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface ActionInputs {
77
apiKey: string;
88
sourceType: SourceType;
99
agentName?: string;
10-
agentVersion: string;
10+
agentVersion?: string;
1111
gitRepository?: string;
1212
gitRef?: string;
1313
path?: string;
@@ -36,7 +36,7 @@ export function getInputs(): ActionInputs {
3636
apiKey: core.getInput('api-key', { required: true }),
3737
sourceType,
3838
agentName: core.getInput('agent-name') || undefined,
39-
agentVersion: core.getInput('agent-version', { required: true }),
39+
agentVersion: core.getInput('agent-version') || undefined,
4040
gitRepository: core.getInput('git-repository') || undefined,
4141
gitRef: core.getInput('git-ref') || undefined,
4242
path: core.getInput('path') || undefined,
@@ -57,7 +57,7 @@ export function getInputs(): ActionInputs {
5757

5858
// Hidden: if called from runloopai/runloop, set is_public based on "public:" version prefix
5959
const { owner, repo } = github.context.repo;
60-
if (owner === 'runloopai' && repo === 'runloop') {
60+
if (owner === 'runloopai' && repo === 'runloop' && inputs.agentVersion) {
6161
if (inputs.agentVersion.startsWith('public:')) {
6262
inputs.agentVersion = inputs.agentVersion.slice('public:'.length);
6363
inputs.isPublic = true;
@@ -132,8 +132,10 @@ export function validateInputs(inputs: ActionInputs): void {
132132
throw new Error('api-key cannot be empty');
133133
}
134134

135-
// Validate agentVersion format (semver or SHA)
136-
validateAgentVersion(inputs.agentVersion);
135+
// Validate agentVersion format (semver or SHA) if provided
136+
if (inputs.agentVersion) {
137+
validateAgentVersion(inputs.agentVersion);
138+
}
137139

138140
// Validate objectTtlDays if provided
139141
if (inputs.objectTtlDays !== undefined) {

0 commit comments

Comments
 (0)