New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

webtyp.com/ghaction

Package Overview
Dependencies
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webtyp.com/ghaction

Go Modules
Version
v0.1.2
Version published
Created
Source

ghaction

Generic GitHub Action and Workflow YAML generation — single source of truth for webtyp composite actions and workflows.

No domain knowledge of gorelease, goflare or other consumers. Provides typed Go structs Action/Workflow + deterministic Render() + Sync() and optimal Node 24 presets.

Installation

go get webtyp.com/ghaction@latest

Usage

Action (composite)

import "webtyp.com/ghaction"

func GoreleaseAction() ghaction.Action {
  return ghaction.Action{
    Name: "Create GitHub Release",
    Steps: []ghaction.Step{
      {Name: "Setup Go", Uses: ghaction.DefaultSetupGo, With: []ghaction.KeyValue{{Key: "go-version-file", Value: "go.mod"}}},
      {Name: "Build", Shell: "bash", Run: buildScript},
    },
  }
}

// in tests/action_sync_test.go
func TestActionYmlIsInSync(t *testing.T) {
  a := GoreleaseAction()
  changed, _ := ghaction.Sync("../action.yml", a)
  if changed { t.Fatal("action.yml out of sync") }
}

Workflow (typed)

func ReleaseWorkflow() ghaction.Workflow {
  return ghaction.Workflow{
    Name: "Release",
    On: ghaction.On{Push: &ghaction.Push{Tags: []string{"v*"}}},
    Permissions: map[string]string{"contents": "write"},
    Jobs: map[string]ghaction.Job{
      "release": {
        RunsOn: ghaction.DefaultRunsOn,
        Steps: []ghaction.WorkflowStep{
          ghaction.CheckoutWithTags(),
          ghaction.SetupGoStep(),
          {Name: "Build", Shell: "bash", Run: buildScript},
        },
      },
    },
  }
}

// in tests/generation_test.go
func TestWorkflowsAreInSync(t *testing.T) {
  ghaction.SyncWorkflow("../.github/workflows/release.yml", ReleaseWorkflow())
}

Presets (optimal defaults, Node 24)

  • DefaultCheckout = "actions/checkout@v5" (Node 24)
  • DefaultSetupGo = "actions/setup-go@v6" (Node 24)
  • CheckoutStep(), CheckoutWithTags(), SetupGoStep(), GoVetStep(), GoTestStep(), PresetTestWorkflow()

Bumping Node versions happens once in presets.go; consumers get it via go get -u + gotest regen.

Why generic?

gorelease owns DefaultTargets, goflare owns TinyGoVersion — ghaction never hardcodes domain strings. Consumers generate bash from their own constants and pass Uses: ghaction.DefaultSetupGo to avoid hardcoding actions/setup-go@v6.

See action.go, workflow.go, presets.go for API.

FAQs

Package last updated on 06 Sep 2026

Related posts