Skip to content

Commit 2f8a38f

Browse files
authored
Add runtime support for Bun JavaScript runtime (#3876)
1 parent eb97742 commit 2f8a38f

5 files changed

Lines changed: 42 additions & 3 deletions

File tree

pkg/constants/constants.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ const DefaultGitHubMCPServerVersion = "v0.20.2"
2929
// DefaultFirewallVersion is the default version of the gh-aw-firewall (AWF) binary
3030
const DefaultFirewallVersion = "v0.1.1"
3131

32+
// DefaultBunVersion is the default version of Bun for runtime setup
33+
const DefaultBunVersion = "1.1"
34+
3235
// DefaultNodeVersion is the default version of Node.js for runtime setup
3336
const DefaultNodeVersion = "24"
3437

pkg/workflow/action_pins_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,9 @@ func TestApplyActionPinToStep(t *testing.T) {
376376
func TestGetActionPinsSorting(t *testing.T) {
377377
pins := getActionPins()
378378

379-
// Verify we got all the pins (should be 16)
380-
if len(pins) != 16 {
381-
t.Errorf("getActionPins() returned %d pins, expected 16", len(pins))
379+
// Verify we got all the pins (should be 17)
380+
if len(pins) != 17 {
381+
t.Errorf("getActionPins() returned %d pins, expected 17", len(pins))
382382
}
383383

384384
// Verify they are sorted by version (descending) then by repository name (ascending)

pkg/workflow/data/action_pins.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
"version": "v8",
88
"sha": "ed597411d8f924073f98dfc5c65a23a2325f34cd"
99
},
10+
"oven-sh/setup-bun": {
11+
"repo": "oven-sh/setup-bun",
12+
"version": "v2",
13+
"sha": "735343b667d3e6f658f44d0eca948eb6282f2b76"
14+
},
1015
"actions/checkout": {
1116
"repo": "actions/checkout",
1217
"version": "v5",

pkg/workflow/runtime_setup.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ type RuntimeRequirement struct {
2828

2929
// knownRuntimes is the list of all supported runtime configurations (alphabetically sorted by ID)
3030
var knownRuntimes = []*Runtime{
31+
{
32+
ID: "bun",
33+
Name: "Bun",
34+
ActionRepo: "oven-sh/setup-bun",
35+
ActionVersion: "v2",
36+
VersionField: "bun-version",
37+
DefaultVersion: constants.DefaultBunVersion,
38+
Commands: []string{"bun", "bunx"},
39+
},
3140
{
3241
ID: "dotnet",
3342
Name: ".NET",

pkg/workflow/runtime_setup_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ func TestDetectRuntimeFromCommand(t *testing.T) {
1111
command string
1212
expected []string // Expected runtime IDs
1313
}{
14+
{
15+
name: "bun command",
16+
command: "bun install",
17+
expected: []string{"bun"},
18+
},
19+
{
20+
name: "bunx command",
21+
command: "bunx tsc",
22+
expected: []string{"bun"},
23+
},
1424
{
1525
name: "npm install command",
1626
command: "npm install",
@@ -257,6 +267,18 @@ func TestGenerateRuntimeSetupSteps(t *testing.T) {
257267
expectSteps int
258268
checkContent []string
259269
}{
270+
{
271+
name: "generates bun setup",
272+
requirements: []RuntimeRequirement{
273+
{Runtime: findRuntimeByID("bun"), Version: "1.1"},
274+
},
275+
expectSteps: 1,
276+
checkContent: []string{
277+
"Setup Bun",
278+
"oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76",
279+
"bun-version: '1.1'",
280+
},
281+
},
260282
{
261283
name: "generates node setup",
262284
requirements: []RuntimeRequirement{

0 commit comments

Comments
 (0)