Skip to content

feat: add support for arrays in workspace parameters #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@ jobs:
Region: us-pittsburgh
```

### Using Array Parameters

The `parameters` input now supports arrays in YAML format. Arrays are automatically serialized to JSON strings when sent to the Coder API, which is useful when your Coder template has parameters that accept JSON-encoded arrays:

```yaml
- name: Start Coder workspace with arrays
uses: coder/[email protected]
with:
coder-url: ${{ secrets.CODER_URL }}
coder-token: ${{ secrets.CODER_TOKEN }}
template-name: multi-region-template
parameters: |-
instance_type: t3.medium
regions:
- us-east-1
- us-west-2
- eu-central-1
services:
- web
- api
- database
```

## Inputs

| Input | Description | Required | Default |
Expand All @@ -70,7 +93,7 @@ jobs:
| `coder-token` | API token for Coder | Yes | - |
| `template-name` | Name of the Coder template to use | Yes | - |
| `workspace-name` | Name for the new workspace | No | `issue-{issue_number}` |
| `parameters` | YAML-formatted parameters for the Coder workspace | Yes | - |
| `parameters` | YAML-formatted parameters for the Coder workspace (supports arrays) | Yes | - |

## How It Works

Expand Down
3 changes: 3 additions & 0 deletions bun.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dependencies": {
"@octokit/rest": "^21.1.1",
"dedent": "^1.5.3",
"undici": "^7.10.0",
"yaml": "^2.7.0",
"zod": "^3.24.2",
},
Expand Down Expand Up @@ -61,6 +62,8 @@

"typescript": ["[email protected]", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-aJn6wq13/afZp/jT9QZmwEjDqqvSGp1VT5GVg+f/t6/oVyrgXM6BY1h9BRh/O5p3PlUPAe+WuiEZOmb/49RqoQ=="],

"undici": ["[email protected]", "", {}, "sha512-u5otvFBOBZvmdjWLVW+5DAc9Nkq8f24g0O9oY7qw2JVIF1VocIFoyz9JFkuVOS2j41AufeO0xnlweJ2RLT8nGw=="],

"undici-types": ["[email protected]", "", {}, "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg=="],

"universal-user-agent": ["[email protected]", "", {}, "sha512-0JCqzSKnStlRRQfCdowvqy3cy0Dvtlb8xecj/H8JFZuCze4rwjPZQOgvFvn0Ws/usCHQFGpyr+pB9adaGwXn4Q=="],
Expand Down
Loading