Skip to content

Commit 6d9801c

Browse files
committed
Initial commit
- Composite action that installs fern-api via npm, with guards for missing node/npm - CI workflow: actionlint (pinned to v1.7.11) + matrix test against latest and 3.81.0 - Dependabot for weekly action updates - Devbox environment with pinned actionlint (1.7.10) and act (0.2.84) for local linting and CI runs - Manual release process via gh CLI
0 parents  commit 6d9801c

6 files changed

Lines changed: 269 additions & 0 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: weekly

.github/workflows/ci.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions: {}
10+
11+
jobs:
12+
validate:
13+
runs-on: ubuntu-24.04
14+
steps:
15+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
16+
17+
- name: Install actionlint
18+
env:
19+
ACTIONLINT_VERSION: "1.7.11"
20+
run: |
21+
curl -fsSL "https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" \
22+
| tar -xz actionlint
23+
echo "$PWD" >> "$GITHUB_PATH"
24+
25+
- name: Lint workflows
26+
run: actionlint
27+
28+
test:
29+
runs-on: ubuntu-24.04
30+
strategy:
31+
fail-fast: false
32+
matrix:
33+
include:
34+
- version: latest
35+
- version: "3.81.0"
36+
steps:
37+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
38+
39+
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
40+
with:
41+
node-version: lts/*
42+
43+
- name: Run action
44+
uses: ./
45+
with:
46+
version: ${{ matrix.version }}
47+
48+
- name: Verify fern is on PATH
49+
run: fern --version

README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# setup-fern-cli
2+
3+
A GitHub Action that installs the [Fern CLI](https://github.com/fern-api/fern) in your workflow.
4+
5+
## Requirements
6+
7+
Node.js and npm must be available before this action runs. Add [`actions/setup-node`](https://github.com/actions/setup-node) as a prior step if your runner doesn't include them by default.
8+
9+
## Usage
10+
11+
```yaml
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: "lts/*"
15+
16+
- uses: fern-api/setup-fern-cli@v1.0.0
17+
```
18+
19+
### With a specific version
20+
21+
```yaml
22+
- uses: fern-api/setup-fern-cli@v1.0.0
23+
with:
24+
version: "3.81.0"
25+
```
26+
27+
## Inputs
28+
29+
| Input | Description | Default |
30+
| --------- | ---------------------------------------- | -------- |
31+
| `version` | Fern CLI version to install (`latest` or semver) | `latest` |
32+
33+
## Example workflow
34+
35+
```yaml
36+
name: Generate SDKs
37+
38+
on:
39+
push:
40+
branches: [main]
41+
42+
jobs:
43+
generate:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- uses: actions/setup-node@v4
49+
with:
50+
node-version: "lts/*"
51+
52+
- uses: fern-api/setup-fern-cli@v1.0.0
53+
54+
- run: fern generate
55+
```
56+
57+
## Releasing
58+
59+
Tag the commit and create a GitHub Release manually:
60+
61+
```sh
62+
git tag v1.0.0
63+
git push origin v1.0.0
64+
gh release create v1.0.0 --generate-notes
65+
```

action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Setup Fern CLI
2+
description: Install and configure the Fern CLI in your GitHub Actions workflow
3+
branding:
4+
icon: package
5+
color: green
6+
7+
inputs:
8+
version:
9+
description: Fern CLI version to install (e.g. "latest", "0.15.0")
10+
default: latest
11+
12+
runs:
13+
using: composite
14+
steps:
15+
- name: Install Fern CLI
16+
shell: bash
17+
env:
18+
VERSION: ${{ inputs.version }}
19+
run: |
20+
if ! command -v npm &>/dev/null; then
21+
echo "Error: npm is not available. Please add a Node.js setup step before this action."
22+
exit 1
23+
fi
24+
if ! command -v node &>/dev/null; then
25+
echo "Error: node is not available. Please add a Node.js setup step before this action."
26+
exit 1
27+
fi
28+
29+
PKG="fern-api"
30+
[ "$VERSION" != "latest" ] && PKG="fern-api@$VERSION"
31+
32+
npm install -g "$PKG"
33+
34+
echo "Installed Fern CLI version $(FERN_NO_VERSION_REDIRECTION=true fern --version)"

devbox.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.7/.schema/devbox.schema.json",
3+
"packages": ["actionlint@1.7.10", "act@0.2.84"],
4+
"shell": {
5+
"scripts": {
6+
"lint": "actionlint",
7+
"ci": "act push --workflows .github/workflows/ci.yml -P ubuntu-24.04=ghcr.io/catthehacker/ubuntu:act-24.04 --container-architecture linux/amd64 --pull=false --concurrent-jobs 1"
8+
}
9+
}
10+
}

devbox.lock

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{
2+
"lockfile_version": "1",
3+
"packages": {
4+
"act@latest": {
5+
"last_modified": "2026-01-23T17:20:52Z",
6+
"resolved": "github:NixOS/nixpkgs/a1bab9e494f5f4939442a57a58d0449a109593fe#act",
7+
"source": "devbox-search",
8+
"version": "0.2.84",
9+
"systems": {
10+
"aarch64-darwin": {
11+
"outputs": [
12+
{
13+
"name": "out",
14+
"path": "/nix/store/60fx8ffpxxfl7chps435jz0yy40bgz7z-act-0.2.84",
15+
"default": true
16+
}
17+
],
18+
"store_path": "/nix/store/60fx8ffpxxfl7chps435jz0yy40bgz7z-act-0.2.84"
19+
},
20+
"aarch64-linux": {
21+
"outputs": [
22+
{
23+
"name": "out",
24+
"path": "/nix/store/jrbdrlv46d8jglg30v078ncxmmc7rfrj-act-0.2.84",
25+
"default": true
26+
}
27+
],
28+
"store_path": "/nix/store/jrbdrlv46d8jglg30v078ncxmmc7rfrj-act-0.2.84"
29+
},
30+
"x86_64-darwin": {
31+
"outputs": [
32+
{
33+
"name": "out",
34+
"path": "/nix/store/j49qnbhrsi7qhw4jn9852f818nxmmj9r-act-0.2.84",
35+
"default": true
36+
}
37+
],
38+
"store_path": "/nix/store/j49qnbhrsi7qhw4jn9852f818nxmmj9r-act-0.2.84"
39+
},
40+
"x86_64-linux": {
41+
"outputs": [
42+
{
43+
"name": "out",
44+
"path": "/nix/store/29dp2s13wyawgm1m5kvsl8n4mh107h8r-act-0.2.84",
45+
"default": true
46+
}
47+
],
48+
"store_path": "/nix/store/29dp2s13wyawgm1m5kvsl8n4mh107h8r-act-0.2.84"
49+
}
50+
}
51+
},
52+
"actionlint@latest": {
53+
"last_modified": "2026-01-23T17:20:52Z",
54+
"resolved": "github:NixOS/nixpkgs/a1bab9e494f5f4939442a57a58d0449a109593fe#actionlint",
55+
"source": "devbox-search",
56+
"version": "1.7.10",
57+
"systems": {
58+
"aarch64-darwin": {
59+
"outputs": [
60+
{
61+
"name": "out",
62+
"path": "/nix/store/92yl15p354llm4lkdq2vjvscljfdp03q-actionlint-1.7.10",
63+
"default": true
64+
}
65+
],
66+
"store_path": "/nix/store/92yl15p354llm4lkdq2vjvscljfdp03q-actionlint-1.7.10"
67+
},
68+
"aarch64-linux": {
69+
"outputs": [
70+
{
71+
"name": "out",
72+
"path": "/nix/store/c756x60xjyyfc1p09670im6ms6b75lxg-actionlint-1.7.10",
73+
"default": true
74+
}
75+
],
76+
"store_path": "/nix/store/c756x60xjyyfc1p09670im6ms6b75lxg-actionlint-1.7.10"
77+
},
78+
"x86_64-darwin": {
79+
"outputs": [
80+
{
81+
"name": "out",
82+
"path": "/nix/store/9n2c90qk316b5xsll2ndsfsl7jrccjhc-actionlint-1.7.10",
83+
"default": true
84+
}
85+
],
86+
"store_path": "/nix/store/9n2c90qk316b5xsll2ndsfsl7jrccjhc-actionlint-1.7.10"
87+
},
88+
"x86_64-linux": {
89+
"outputs": [
90+
{
91+
"name": "out",
92+
"path": "/nix/store/r9iw80i3mm22lj116h1bxvnc53kkry2s-actionlint-1.7.10",
93+
"default": true
94+
}
95+
],
96+
"store_path": "/nix/store/r9iw80i3mm22lj116h1bxvnc53kkry2s-actionlint-1.7.10"
97+
}
98+
}
99+
},
100+
"github:NixOS/nixpkgs/nixpkgs-unstable": {
101+
"last_modified": "2026-02-11T21:01:36Z",
102+
"resolved": "github:NixOS/nixpkgs/2343bbb58f99267223bc2aac4fc9ea301a155a16?lastModified=1770843696&narHash=sha256-LovWTGDwXhkfCOmbgLVA10bvsi%2FP8eDDpRudgk68HA8%3D"
103+
}
104+
}
105+
}

0 commit comments

Comments
 (0)