Skip to content

Commit b736819

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 b736819

5 files changed

Lines changed: 19 additions & 57 deletions

File tree

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ 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.1.123"). Not used for git or object agents.'
25+
required: false
2626

2727
# Git source inputs
2828
git-repository:
2929
description: 'Git repository URL (optional override, defaults to current repository)'
3030
required: false
3131

3232
git-ref:
33-
description: 'Git ref (branch/tag/commit SHA). Defaults to current commit or release tag'
33+
description: 'Git ref (branch or tag). Defaults to current ref or release tag'
3434
required: false
3535

3636
# NPM source inputs

dist/index.js

Lines changed: 7 additions & 22 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: 3 additions & 26 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,9 +132,6 @@ 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);
137-
138135
// Validate objectTtlDays if provided
139136
if (inputs.objectTtlDays !== undefined) {
140137
if (isNaN(inputs.objectTtlDays) || inputs.objectTtlDays <= 0) {
@@ -170,23 +167,3 @@ export function resolvePath(inputPath: string): string {
170167

171168
return path.isAbsolute(inputPath) ? inputPath : path.join(workspace, inputPath);
172169
}
173-
174-
// Semver pattern: major.minor.patch with optional pre-release and build metadata
175-
const SEMVER_REGEX = /^\d+\.\d+\.\d+(-[\w.-]+)?(\+[\w.-]+)?$/;
176-
177-
// Git SHA pattern: 7-40 hex characters (short or full SHA)
178-
const SHA_REGEX = /^[a-f0-9]{7,40}$/i;
179-
180-
function validateAgentVersion(version: string): void {
181-
if (!version || version.trim().length === 0) {
182-
throw new Error('agent-version cannot be empty');
183-
}
184-
185-
const trimmed = version.trim();
186-
187-
if (!SEMVER_REGEX.test(trimmed) && !SHA_REGEX.test(trimmed)) {
188-
throw new Error(
189-
`Invalid agent-version: "${version}". Must be a semver string (e.g., "2.0.65") or a git SHA (7-40 hex characters).`
190-
);
191-
}
192-
}

0 commit comments

Comments
 (0)