Skip to content
Merged
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
39 changes: 38 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,48 @@ on:
branches: [main, master]
jobs:
test:
runs-on: [self-hosted, Linux, X64]
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- run: go build ./...
- run: go test ./... -v -race -count=1
env:
GOPRIVATE: github.com/GoCodeAlone/*
GONOSUMCHECK: github.com/GoCodeAlone/*

strict-contracts:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
name: Validate strict plugin contracts
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Verify plugin.json exists
run: |
test -f plugin.json || { echo "ERROR: plugin.json is missing — every release must include a strict contract manifest"; exit 1; }
- uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run strict contract tests
run: |
go test ./internal/... -run "TestPluginStepSchemasJSON|TestPluginManifestEngineValidation|TestModuleSchemas" -v -count=1
env:
GOPRIVATE: github.com/GoCodeAlone/*
GONOSUMCHECK: github.com/GoCodeAlone/*
- name: Validate plugin.json with wfctl
run: |
# wfctl validates registry-format manifests; strict contract schema coverage is enforced
# by the Go tests above. This step runs informational validation and logs the result.
set +e
go run github.com/GoCodeAlone/workflow/cmd/wfctl@v0.3.56 plugin validate --file plugin.json 2>&1
wfctl_exit=$?
set -e
echo "wfctl validation exit code: ${wfctl_exit}"
env:
GOPRIVATE: github.com/GoCodeAlone/*
GONOSUMCHECK: github.com/GoCodeAlone/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ module github.com/GoCodeAlone/workflow-plugin-github

go 1.26.0

require github.com/GoCodeAlone/workflow v0.3.56
require (
github.com/GoCodeAlone/workflow v0.3.56
github.com/golang-jwt/jwt/v5 v5.3.1
github.com/google/go-github/v69 v69.2.0
golang.org/x/crypto v0.48.0
)

require (
cel.dev/expr v0.25.1 // indirect
Expand Down Expand Up @@ -94,10 +99,8 @@ require (
github.com/go-logr/logr v1.4.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
github.com/golobby/cast v1.3.3 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/go-github/v69 v69.2.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
Expand Down Expand Up @@ -201,7 +204,6 @@ require (
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.1 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
golang.org/x/crypto v0.48.0 // indirect
golang.org/x/exp v0.0.0-20260218203240-3dfff04db8fa // indirect
golang.org/x/mod v0.33.0 // indirect
golang.org/x/net v0.51.0 // indirect
Expand Down
86 changes: 86 additions & 0 deletions internal/schemas.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
package internal

import sdk "github.com/GoCodeAlone/workflow/plugin/external/sdk"

// Ensure githubPlugin satisfies sdk.SchemaProvider at compile time.
var _ sdk.SchemaProvider = (*githubPlugin)(nil)

// ModuleSchemas returns schema descriptors for all module types provided by
// this plugin. Implementing sdk.SchemaProvider allows the engine to surface
// module configuration fields and I/O contracts at startup and in the UI.
func (p *githubPlugin) ModuleSchemas() []sdk.ModuleSchemaData {
return []sdk.ModuleSchemaData{
{
Type: "git.webhook",
Label: "GitHub Webhook",
Category: "github",
Description: "Receives GitHub webhook events via HTTP, verifies HMAC-SHA256 signatures, and publishes normalised GitEvent messages to a configurable topic.",
ConfigFields: []sdk.ConfigField{
{
Name: "provider",
Type: "string",
Description: "Webhook provider identifier. Accepted for backward compatibility; the module always publishes events with provider 'github'.",
DefaultValue: "github",
Required: false,
},
{
Name: "secret",
Type: "string",
Description: "Webhook secret used to verify the X-Hub-Signature-256 header. Leave empty to skip signature verification.",
Required: false,
},
{
Name: "events",
Type: "array",
Description: "Event types to accept (e.g. push, pull_request). An empty list accepts all event types.",
Required: false,
},
{
Name: "topic",
Type: "string",
Description: "Message-bus topic to which normalised GitEvent payloads are published.",
DefaultValue: "git.events",
Required: false,
},
},
Outputs: []sdk.ServiceIO{
{Name: "provider", Type: "string", Description: "Webhook provider (always 'github')"},
{Name: "event_type", Type: "string", Description: "GitHub event type (e.g. push, pull_request)"},
{Name: "repository", Type: "string", Description: "Repository full name (owner/repo)"},
{Name: "branch", Type: "string", Description: "Branch or ref name"},
{Name: "commit", Type: "string", Description: "Commit SHA"},
{Name: "author", Type: "string", Description: "Event author username"},
{Name: "message", Type: "string", Description: "Commit message or PR title"},
{Name: "url", Type: "string", Description: "URL to the commit or PR"},
{Name: "raw_payload", Type: "object", Description: "Raw JSON webhook payload"},
{Name: "timestamp", Type: "string", Description: "Event timestamp in RFC3339 format"},
},
},
{
Type: "github.app",
Label: "GitHub App",
Category: "github",
Description: "Authenticates as a GitHub App installation, generating short-lived installation access tokens from an App private key. Tokens are cached and refreshed automatically.",
ConfigFields: []sdk.ConfigField{
{
Name: "app_id",
Type: "number",
Description: "GitHub App ID",
Required: true,
},
{
Name: "installation_id",
Type: "number",
Description: "GitHub App installation ID",
Required: true,
},
{
Name: "private_key",
Type: "string",
Description: "PEM-encoded RSA private key for the GitHub App (supports env var references e.g. ${GITHUB_APP_PRIVATE_KEY})",
Required: true,
},
},
},
}
}
Loading