Skip to content

Commit c92c9cb

Browse files
intel352claude
andcommitted
Add workflow-plugin-github: GitHub webhook and Actions integration
Implements git.webhook module (HMAC-SHA256 signature validation, event normalization, broker publishing) and step.gh_action_trigger, step.gh_action_status, step.gh_create_check pipeline steps. 54 tests passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
0 parents  commit c92c9cb

16 files changed

Lines changed: 3100 additions & 0 deletions

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.PHONY: build test install clean
2+
3+
BINARY_NAME = workflow-plugin-github
4+
INSTALL_DIR ?= data/plugins/$(BINARY_NAME)
5+
6+
build:
7+
GOPRIVATE=github.com/GoCodeAlone/* go build -o bin/$(BINARY_NAME) ./cmd/$(BINARY_NAME)
8+
9+
test:
10+
GOPRIVATE=github.com/GoCodeAlone/* go test ./... -v -race
11+
12+
install: build
13+
mkdir -p $(DESTDIR)/$(INSTALL_DIR)
14+
cp bin/$(BINARY_NAME) $(DESTDIR)/$(INSTALL_DIR)/
15+
cp plugin.json $(DESTDIR)/$(INSTALL_DIR)/
16+
17+
clean:
18+
rm -rf bin/

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# workflow-plugin-github
2+
3+
GitHub integration plugin for the [workflow engine](https://github.com/GoCodeAlone/workflow). Provides GitHub webhook handling and GitHub Actions workflow management.
4+
5+
## Capabilities
6+
7+
### Module: `git.webhook`
8+
9+
Receives GitHub webhook events, validates HMAC-SHA256 signatures, normalizes payloads to a common `GitEvent` schema, and publishes to a configured message broker topic.
10+
11+
```yaml
12+
modules:
13+
- name: github-webhooks
14+
type: git.webhook
15+
config:
16+
provider: github
17+
secret: "${GITHUB_WEBHOOK_SECRET}"
18+
events: [push, pull_request, release]
19+
topic: "git.events"
20+
```
21+
22+
The module registers an HTTP handler at `/webhooks/github`. Configure your GitHub repository webhook to point to `https://<host>/webhooks/github`.
23+
24+
### Step: `step.gh_action_trigger`
25+
26+
Triggers a GitHub Actions workflow via `workflow_dispatch`.
27+
28+
```yaml
29+
- type: step.gh_action_trigger
30+
config:
31+
owner: "GoCodeAlone"
32+
repo: "workflow"
33+
workflow: "ci.yml"
34+
ref: "main"
35+
inputs:
36+
environment: "staging"
37+
token: "${GITHUB_TOKEN}"
38+
```
39+
40+
### Step: `step.gh_action_status`
41+
42+
Checks or polls the status of a GitHub Actions workflow run.
43+
44+
```yaml
45+
- type: step.gh_action_status
46+
config:
47+
owner: "GoCodeAlone"
48+
repo: "workflow"
49+
run_id: 123456
50+
token: "${GITHUB_TOKEN}"
51+
wait: true
52+
poll_interval: "10s"
53+
timeout: "30m"
54+
```
55+
56+
### Step: `step.gh_create_check`
57+
58+
Creates a GitHub Check Run (commit status check).
59+
60+
```yaml
61+
- type: step.gh_create_check
62+
config:
63+
owner: "GoCodeAlone"
64+
repo: "workflow"
65+
sha: "abc123"
66+
name: "workflow-ci"
67+
status: "completed"
68+
conclusion: "success"
69+
title: "CI Pipeline"
70+
summary: "All tests passed"
71+
token: "${GITHUB_TOKEN}"
72+
```
73+
74+
## Building
75+
76+
```sh
77+
make build
78+
# binary at bin/workflow-plugin-github
79+
```
80+
81+
## Testing
82+
83+
```sh
84+
make test
85+
```
86+
87+
## Installation
88+
89+
```sh
90+
make install DESTDIR=/path/to/workflow
91+
```
92+
93+
## License
94+
95+
MIT

cmd/workflow-plugin-github/main.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Command workflow-plugin-github is a workflow engine external plugin that
2+
// provides GitHub integration: webhook handling and GitHub Actions workflow
3+
// management. It runs as a subprocess and communicates with the host workflow
4+
// engine via the go-plugin protocol.
5+
package main
6+
7+
import (
8+
"github.com/GoCodeAlone/workflow-plugin-github/internal"
9+
sdk "github.com/GoCodeAlone/workflow/plugin/external/sdk"
10+
)
11+
12+
func main() {
13+
sdk.Serve(internal.NewGitHubPlugin())
14+
}

go.mod

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
module github.com/GoCodeAlone/workflow-plugin-github
2+
3+
go 1.26
4+
5+
require github.com/GoCodeAlone/workflow v0.2.2
6+
7+
require (
8+
cel.dev/expr v0.25.1 // indirect
9+
cloud.google.com/go v0.123.0 // indirect
10+
cloud.google.com/go/auth v0.18.1 // indirect
11+
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
12+
cloud.google.com/go/compute/metadata v0.9.0 // indirect
13+
cloud.google.com/go/iam v1.5.3 // indirect
14+
cloud.google.com/go/monitoring v1.24.3 // indirect
15+
cloud.google.com/go/storage v1.60.0 // indirect
16+
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
17+
github.com/BurntSushi/toml v1.6.0 // indirect
18+
github.com/CrisisTextLine/modular v1.11.11 // indirect
19+
github.com/CrisisTextLine/modular/modules/auth v0.4.0 // indirect
20+
github.com/CrisisTextLine/modular/modules/eventbus/v2 v2.0.0 // indirect
21+
github.com/DataDog/datadog-go/v5 v5.4.0 // indirect
22+
github.com/GoCodeAlone/go-plugin v0.0.0-20260220090904-b4c35f0e4271 // indirect
23+
github.com/GoCodeAlone/yaegi v0.17.1 // indirect
24+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.30.0 // indirect
25+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/metric v0.55.0 // indirect
26+
github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapping v0.55.0 // indirect
27+
github.com/IBM/sarama v1.46.3 // indirect
28+
github.com/Microsoft/go-winio v0.6.2 // indirect
29+
github.com/aws/aws-sdk-go-v2 v1.41.1 // indirect
30+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect
31+
github.com/aws/aws-sdk-go-v2/config v1.32.7 // indirect
32+
github.com/aws/aws-sdk-go-v2/credentials v1.19.7 // indirect
33+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17 // indirect
34+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 // indirect
35+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 // indirect
36+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
37+
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.17 // indirect
38+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect
39+
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.8 // indirect
40+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17 // indirect
41+
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.17 // indirect
42+
github.com/aws/aws-sdk-go-v2/service/kinesis v1.38.0 // indirect
43+
github.com/aws/aws-sdk-go-v2/service/s3 v1.96.0 // indirect
44+
github.com/aws/aws-sdk-go-v2/service/signin v1.0.5 // indirect
45+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.9 // indirect
46+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.13 // indirect
47+
github.com/aws/aws-sdk-go-v2/service/sts v1.41.6 // indirect
48+
github.com/aws/smithy-go v1.24.0 // indirect
49+
github.com/beorn7/perks v1.0.1 // indirect
50+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
51+
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
52+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
53+
github.com/cloudevents/sdk-go/v2 v2.16.2 // indirect
54+
github.com/cncf/xds/go v0.0.0-20251210132809-ee656c7534f5 // indirect
55+
github.com/containerd/errdefs v1.0.0 // indirect
56+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
57+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
58+
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
59+
github.com/distribution/reference v0.6.0 // indirect
60+
github.com/docker/docker v28.5.2+incompatible // indirect
61+
github.com/docker/go-connections v0.6.0 // indirect
62+
github.com/docker/go-units v0.5.0 // indirect
63+
github.com/dustin/go-humanize v1.0.1 // indirect
64+
github.com/eapache/go-resiliency v1.7.0 // indirect
65+
github.com/eapache/go-xerial-snappy v0.0.0-20230731223053-c322873962e3 // indirect
66+
github.com/eapache/queue v1.1.0 // indirect
67+
github.com/envoyproxy/go-control-plane/envoy v1.36.0 // indirect
68+
github.com/envoyproxy/protoc-gen-validate v1.3.0 // indirect
69+
github.com/fatih/color v1.18.0 // indirect
70+
github.com/felixge/httpsnoop v1.0.4 // indirect
71+
github.com/fsnotify/fsnotify v1.9.0 // indirect
72+
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
73+
github.com/go-logr/logr v1.4.3 // indirect
74+
github.com/go-logr/stdr v1.2.2 // indirect
75+
github.com/golang-jwt/jwt/v5 v5.3.1 // indirect
76+
github.com/golang/snappy v0.0.4 // indirect
77+
github.com/golobby/cast v1.3.3 // indirect
78+
github.com/google/s2a-go v0.1.9 // indirect
79+
github.com/google/uuid v1.6.0 // indirect
80+
github.com/googleapis/enterprise-certificate-proxy v0.3.11 // indirect
81+
github.com/googleapis/gax-go/v2 v2.17.0 // indirect
82+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.7 // indirect
83+
github.com/hashicorp/errwrap v1.1.0 // indirect
84+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
85+
github.com/hashicorp/go-hclog v1.6.3 // indirect
86+
github.com/hashicorp/go-multierror v1.1.1 // indirect
87+
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
88+
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
89+
github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0 // indirect
90+
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
91+
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
92+
github.com/hashicorp/go-uuid v1.0.3 // indirect
93+
github.com/hashicorp/hcl v1.0.1-vault-7 // indirect
94+
github.com/hashicorp/vault/api v1.22.0 // indirect
95+
github.com/hashicorp/yamux v0.1.2 // indirect
96+
github.com/itchyny/gojq v0.12.18 // indirect
97+
github.com/itchyny/timefmt-go v0.1.7 // indirect
98+
github.com/jackc/pgpassfile v1.0.0 // indirect
99+
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
100+
github.com/jackc/pgx/v5 v5.7.5 // indirect
101+
github.com/jackc/puddle/v2 v2.2.2 // indirect
102+
github.com/jcmturner/aescts/v2 v2.0.0 // indirect
103+
github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
104+
github.com/jcmturner/gofork v1.7.6 // indirect
105+
github.com/jcmturner/gokrb5/v8 v8.4.4 // indirect
106+
github.com/jcmturner/rpc/v2 v2.0.3 // indirect
107+
github.com/json-iterator/go v1.1.12 // indirect
108+
github.com/klauspost/compress v1.18.3 // indirect
109+
github.com/mattn/go-colorable v0.1.14 // indirect
110+
github.com/mattn/go-isatty v0.0.20 // indirect
111+
github.com/mitchellh/go-homedir v1.1.0 // indirect
112+
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
113+
github.com/mitchellh/mapstructure v1.5.0 // indirect
114+
github.com/moby/docker-image-spec v1.3.1 // indirect
115+
github.com/moby/sys/sequential v0.6.0 // indirect
116+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
117+
github.com/modern-go/reflect2 v1.0.2 // indirect
118+
github.com/nats-io/nats.go v1.48.0 // indirect
119+
github.com/nats-io/nkeys v0.4.12 // indirect
120+
github.com/nats-io/nuid v1.0.1 // indirect
121+
github.com/ncruces/go-strftime v1.0.0 // indirect
122+
github.com/oklog/run v1.2.0 // indirect
123+
github.com/opencontainers/go-digest v1.0.0 // indirect
124+
github.com/opencontainers/image-spec v1.1.1 // indirect
125+
github.com/pierrec/lz4/v4 v4.1.22 // indirect
126+
github.com/pkg/errors v0.9.1 // indirect
127+
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
128+
github.com/prometheus/client_golang v1.19.1 // indirect
129+
github.com/prometheus/client_model v0.6.2 // indirect
130+
github.com/prometheus/common v0.48.0 // indirect
131+
github.com/prometheus/procfs v0.12.0 // indirect
132+
github.com/rcrowley/go-metrics v0.0.0-20250401214520-65e299d6c5c9 // indirect
133+
github.com/redis/go-redis/v9 v9.18.0 // indirect
134+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
135+
github.com/ryanuber/go-glob v1.0.0 // indirect
136+
github.com/spiffe/go-spiffe/v2 v2.6.0 // indirect
137+
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
138+
go.opentelemetry.io/contrib/detectors/gcp v1.39.0 // indirect
139+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.63.0 // indirect
140+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.65.0 // indirect
141+
go.opentelemetry.io/otel v1.40.0 // indirect
142+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.40.0 // indirect
143+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.40.0 // indirect
144+
go.opentelemetry.io/otel/metric v1.40.0 // indirect
145+
go.opentelemetry.io/otel/sdk v1.40.0 // indirect
146+
go.opentelemetry.io/otel/sdk/metric v1.40.0 // indirect
147+
go.opentelemetry.io/otel/trace v1.40.0 // indirect
148+
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
149+
go.uber.org/atomic v1.11.0 // indirect
150+
go.uber.org/multierr v1.11.0 // indirect
151+
go.uber.org/zap v1.27.0 // indirect
152+
golang.org/x/crypto v0.48.0 // indirect
153+
golang.org/x/exp v0.0.0-20251023183803-a4bb9ffd2546 // indirect
154+
golang.org/x/net v0.50.0 // indirect
155+
golang.org/x/oauth2 v0.35.0 // indirect
156+
golang.org/x/sync v0.19.0 // indirect
157+
golang.org/x/sys v0.41.0 // indirect
158+
golang.org/x/text v0.34.0 // indirect
159+
golang.org/x/time v0.14.0 // indirect
160+
google.golang.org/api v0.265.0 // indirect
161+
google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 // indirect
162+
google.golang.org/genproto/googleapis/api v0.0.0-20260203192932-546029d2fa20 // indirect
163+
google.golang.org/genproto/googleapis/rpc v0.0.0-20260217215200-42d3e9bedb6d // indirect
164+
google.golang.org/grpc v1.79.1 // indirect
165+
google.golang.org/protobuf v1.36.11 // indirect
166+
gopkg.in/yaml.v3 v3.0.1 // indirect
167+
modernc.org/libc v1.67.6 // indirect
168+
modernc.org/mathutil v1.7.1 // indirect
169+
modernc.org/memory v1.11.0 // indirect
170+
modernc.org/sqlite v1.45.0 // indirect
171+
)

0 commit comments

Comments
 (0)