11# CodeForge SDK Generation Action
22
3- Automatically trigger SDK regeneration on [ CodeForge] ( https://code-forge.net ) when your OpenAPI specification changes.
3+ Automatically trigger SDK regeneration on [ CodeForge] ( https://code-forge.net )
4+ when your OpenAPI specification changes.
45
56## Quick Start
67
@@ -21,29 +22,23 @@ jobs:
2122 - name : Trigger SDK Generation
2223 uses : code-forge/generation-action@v1
2324 with :
24- spec_id : ${{ secrets.CODEFORGE_SPEC_ID }}
25+ spec_id : 4aa2cde8-3978-4b0a-b9b8-4fef6d440e0e
2526 api_token : ${{ secrets.CODEFORGE_API_TOKEN }}
26- spec_path : api/openapi.yaml
2727` ` `
2828
2929## Inputs
3030
31- | Input | Required | Default | Description |
32- |-------|----------|---------|-------------|
33- | ` spec_id` | Yes | — | CodeForge spec ID (find in the platform UI) |
34- | `api_token` | Yes | — | CodeForge API token (generate in Account Settings) |
35- | `spec_path` | Yes | — | Path to your OpenAPI spec file in the repo (e.g. `api/openapi.yaml`) |
36- | `sdk_ids` | No | all SDKs | Comma-separated SDK IDs to regenerate |
37- | `wait_for_completion` | No | `true` | Wait for generation to complete before finishing the step |
38- | `fail_on_error` | No | `true` | Fail the workflow if SDK generation fails |
31+ | Input | Required | Description |
32+ | ----------- | -------- | -------------------------------------------------------- |
33+ | ` spec_id` | Yes | CodeForge document instance ID (find in the platform UI) |
34+ | `api_token` | Yes | CodeForge API token (generate in Account Settings) |
3935
4036# # Outputs
4137
42- | Output | Description |
43- |--------|-------------|
44- | `status` | Generation status : ` success` , `failed`, or `in_progress` |
45- | `generation_urls` | Comma-separated URLs to view logs on CodeForge |
46- | `published_packages` | JSON array of published package info (name, version, registry_url) |
38+ | Output | Description |
39+ | ---------------- | --------------------------------------------- |
40+ | `checks_started` | Number of generation checks that were started |
41+ | `logs_url` | URL to view generation logs on CodeForge |
4742
4843# ## Using Outputs
4944
@@ -52,149 +47,48 @@ jobs:
5247 id: generate
5348 uses: code-forge/generation-action@v1
5449 with:
55- spec_id: ${{ secrets.CODEFORGE_SPEC_ID }}
50+ spec_id: 4aa2cde8-3978-4b0a-b9b8-4fef6d440e0e
5651 api_token: ${{ secrets.CODEFORGE_API_TOKEN }}
57- spec_path: api/openapi.yaml
5852
59- - name: Print published packages
60- run: echo "${{ steps.generate.outputs.published_packages }}"
53+ - name: Print logs URL
54+ run: echo "${{ steps.generate.outputs.logs_url }}"
6155` ` `
6256
6357# # Setup Guide
6458
65- # ## 1. Get your Spec ID
59+ # ## 1. Get your Document Instance ID
6660
67611. Log in to [code-forge.net](https://code-forge.net)
68- 2. Navigate to your spec in the platform UI
69- 3. The spec ID is shown in the URL : ` code-forge.net/specs/**spec_123**/...`
62+ 2. Navigate to your document instance in the platform UI
63+ 3. The ID is shown in the URL :
64+ ` code-forge.net/platform/document-instances/**your-id**/...`
7065
7166# ## 2. Generate an API Token
7267
73681. Go to **Account Settings** → **API Tokens**
74692. Click **Generate New Token**
75703. Copy the token (it will only be shown once)
7671
77- # ## 3. Add Secrets to GitHub
72+ # ## 3. Add your API Token to GitHub
7873
79- 1. Go to your repository → **Settings** → **Secrets and variables** → **Actions**
80- 2. Add `CODEFORGE_SPEC_ID` with your spec ID
81- 3. Add `CODEFORGE_API_TOKEN` with your API token
82-
83- # # Examples
84-
85- # ## Basic — Regenerate All SDKs
86-
87- ` ` ` yaml
88- - uses: code-forge/generation-action@v1
89- with:
90- spec_id: ${{ secrets.CODEFORGE_SPEC_ID }}
91- api_token: ${{ secrets.CODEFORGE_API_TOKEN }}
92- spec_path: openapi.yaml
93- ` ` `
94-
95- # ## Regenerate Specific SDKs Only
96-
97- ` ` ` yaml
98- - uses: code-forge/generation-action@v1
99- with:
100- spec_id: ${{ secrets.CODEFORGE_SPEC_ID }}
101- api_token: ${{ secrets.CODEFORGE_API_TOKEN }}
102- spec_path: openapi.yaml
103- sdk_ids: sdk_789,sdk_012
104- ` ` `
105-
106- # ## Fire-and-Forget (Don't Wait for Completion)
107-
108- ` ` ` yaml
109- - uses: code-forge/generation-action@v1
110- with:
111- spec_id: ${{ secrets.CODEFORGE_SPEC_ID }}
112- api_token: ${{ secrets.CODEFORGE_API_TOKEN }}
113- spec_path: openapi.yaml
114- wait_for_completion: false
115- ` ` `
116-
117- # ## Continue Even if Generation Fails
118-
119- ` ` ` yaml
120- - uses: code-forge/generation-action@v1
121- with:
122- spec_id: ${{ secrets.CODEFORGE_SPEC_ID }}
123- api_token: ${{ secrets.CODEFORGE_API_TOKEN }}
124- spec_path: openapi.yaml
125- fail_on_error: false
126- ` ` `
127-
128- # ## Full Example with Multiple SDKs and Outputs
129-
130- ` ` ` yaml
131- name: Regenerate SDKs on Spec Change
132-
133- on:
134- push:
135- branches: [main]
136- paths:
137- - 'api/openapi.yaml'
138-
139- jobs:
140- generate-sdks:
141- runs-on: ubuntu-latest
142- steps:
143- - uses: actions/checkout@v4
144-
145- - name: Trigger SDK Generation
146- id: generate
147- uses: code-forge/generation-action@v1
148- with:
149- spec_id: ${{ secrets.CODEFORGE_SPEC_ID }}
150- api_token: ${{ secrets.CODEFORGE_API_TOKEN }}
151- spec_path: api/openapi.yaml
152- sdk_ids: sdk_typescript,sdk_python,sdk_go
153- wait_for_completion: true
154- fail_on_error: true
155-
156- - name: Print results
157- run: |
158- echo "Status: ${{ steps.generate.outputs.status }}"
159- echo "Logs: ${{ steps.generate.outputs.generation_urls }}"
160- echo "Packages: ${{ steps.generate.outputs.published_packages }}"
161- ` ` `
74+ 1. Go to your repository → **Settings** → **Secrets and variables** →
75+ **Actions**
76+ 2. Under **Secrets**, add `CODEFORGE_API_TOKEN` with your API token
16277
16378# # Troubleshooting
16479
16580# ## `Invalid CodeForge API token`
16681
167- - Verify the token is correctly copied to your GitHub secret (no trailing spaces)
82+ - Verify the token is correctly copied to your GitHub secret (no trailing
83+ spaces)
16884- Check the token hasn't expired or been revoked in Account Settings
16985- Ensure the secret name in your workflow matches (`CODEFORGE_API_TOKEN`)
17086
171- # ## `Spec not found` (404)
172-
173- - Double-check the `spec_id` value — it should match the ID shown in the CodeForge platform URL
174- - Confirm the API token has access to this spec
175-
176- # ## `Invalid OpenAPI spec`
177-
178- - Your `openapi.yaml` file contains validation errors
179- - Run a local validator (e.g. `npx @redocly/cli lint openapi.yaml`) before pushing
180-
181- # ## `No such file or directory` for spec_path
182-
183- - The `spec_path` input must be relative to the repository root
184- - Ensure the file exists and the path is correct (e.g. `api/openapi.yaml`, not `/api/openapi.yaml`)
185- - Make sure `actions/checkout@v4` runs before this action
186-
187- # ## `Generation timeout`
188-
189- - Generation took longer than the 5-minute default polling window
190- - Set `wait_for_completion : false` to trigger generation without waiting, and check the CodeForge platform directly
191- - If this happens frequently, contact CodeForge support
192-
193- # ## `SDK generation failed`
87+ # ## `Specification not found` (404)
19488
195- - Check the `generation_urls` output for detailed logs on the CodeForge platform
196- - Common causes : invalid spec, broken SDK configuration, or a temporary platform issue
197- - Set `fail_on_error : false` if you want the workflow to continue regardless
89+ - Double-check the `spec_id` value — it should match the document instance ID
90+ shown in the CodeForge platform URL
91+ - Confirm the API token has access to this document instance
19892
19993# # Release Process
20094
0 commit comments