Skip to content
Open
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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: ci

on:
pull_request:
# labeled/unlabeled: release-checks reads the PR labels from the event (release:major-approved).
# closed: notify marks the PR's needs-human card handled and closes its CI incident.
types: [opened, edited, synchronize, reopened, labeled, unlabeled, closed]
push:
branches: [main]

permissions: {}

jobs:
ci:
uses: compliance-framework/workflows/.github/workflows/ci-go-plugin.yml@dc7434879fbd0db1d1df9f590ed8bc13789bd320 # v1.9.2
permissions:
actions: read
contents: read
pull-requests: read
security-events: write
secrets: inherit

release-checks:
uses: compliance-framework/workflows/.github/workflows/release-checks.yml@dc7434879fbd0db1d1df9f590ed8bc13789bd320 # v1.9.2
permissions:
contents: read

notify:
needs: [ci, release-checks]
if: always()
uses: compliance-framework/workflows/.github/workflows/notify-failure.yml@dc7434879fbd0db1d1df9f590ed8bc13789bd320 # v1.9.2
with:
needs: ${{ toJSON(needs) }}
permissions:
contents: read
secrets: inherit
11 changes: 11 additions & 0 deletions .github/workflows/cut-prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: cut-prerelease
on:
workflow_dispatch:
permissions:
contents: read
jobs:
cut:
uses: compliance-framework/workflows/.github/workflows/cut-prerelease.yml@dc7434879fbd0db1d1df9f590ed8bc13789bd320 # v1.9.2
permissions:
contents: read
secrets: inherit
26 changes: 26 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Publishes :pr-<number> previews for PRs labelled `preview` (no :main previews for plugins).
name: preview

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, labeled]

permissions:
contents: read

concurrency:
# A merged PR's events carry the base branch as github.ref, so key PR runs by number.
group: preview-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
preview:
uses: compliance-framework/workflows/.github/workflows/preview.yml@dc7434879fbd0db1d1df9f590ed8bc13789bd320 # v1.9.2
with:
kind: go-plugin
on-main: false
permissions:
contents: read
packages: write
19 changes: 19 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Opens/updates the release PR and, once it merges, tags and publishes the release.
name: release-please

on:
push:
branches: [main]

permissions:
contents: read

concurrency:
group: release-please

jobs:
release-please:
uses: compliance-framework/workflows/.github/workflows/release-please.yml@dc7434879fbd0db1d1df9f590ed8bc13789bd320 # v1.9.2
permissions:
contents: read
secrets: inherit
19 changes: 19 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Publishes the effector (goreleaser archives + gooci upload) when a release is published.
# No protocol-version input: the agent runs an effector by its `type: effector`, not by the
# plugin protocol annotation, so the shared workflow's default annotation is left as is.
name: release

on:
release:
types: [published]

permissions:
contents: read

jobs:
release:
uses: compliance-framework/workflows/.github/workflows/release-go-plugin.yml@dc7434879fbd0db1d1df9f590ed8bc13789bd320 # v1.9.2
permissions:
contents: write # goreleaser attaches the archives to the release
packages: write
secrets: inherit
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.idea/
.DS_Store
/bin/
/dist/
cover.out
42 changes: 42 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# Builds the effector plugin for the agent. The agent unpacks the OCI artifact and runs the
# binary named "plugin", as it does for collector plugins.

version: 2

before:
hooks:
- go mod tidy

builds:
- binary: plugin
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/compliance-framework/effector-github-settings/internal.Version={{ .Version }}
goos:
- linux
- darwin

archives:
- formats: [tar.gz]
# this name template makes the OS and Arch compatible with the results of `uname`.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}

# The shared release workflow requires prerelease: auto, so an rc tag stays a pre-release.
release:
prerelease: auto
replace_existing_artifacts: true

changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.0"
}
32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# effector-github-settings: a CCF effector plugin. release-please cuts the releases; the shared
# release workflow (.github/workflows/release.yml) builds them with goreleaser and publishes them
# as an OCI artifact.

MODULE := github.com/compliance-framework/effector-github-settings
BIN := dist/plugin
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
LDFLAGS := -X $(MODULE)/internal.Version=$(VERSION)

##@ Help
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\033[1mUsage\033[0m\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

##@ Development
build: clean ## Build the plugin binary into dist/plugin
@mkdir -p dist
go build -ldflags "$(LDFLAGS)" -o $(BIN) .

test: ## Run the tests (a fake GitHub on httptest; never the real API)
go test -race ./...

lint: ## Run go vet and golangci-lint
go vet ./...
golangci-lint run ./...

tidy-check: ## Fail when go mod tidy would change go.mod or go.sum
go mod tidy -diff

clean: ## Remove build artifacts
rm -rf dist

.PHONY: help build test lint tidy-check clean
67 changes: 67 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
module github.com/compliance-framework/effector-github-settings

go 1.26.1

toolchain go1.27.4

// TEMPORARY until the final PR of this stack: build against sibling checkouts of
// compliance-framework/agent (effector package) and compliance-framework/api (pkg/effector/params,
// which the agent replaces with its sibling too) at their effectors stack tops. CI fails on
// module resolution until the final PR requires the released agent and api rcs instead.
replace github.com/compliance-framework/agent => ../agent

replace github.com/compliance-framework/api => ../api

require (
github.com/compliance-framework/agent v0.0.0-00010101000000-000000000000
github.com/compliance-framework/api v0.22.5
github.com/stretchr/testify v1.12.1
google.golang.org/protobuf v1.36.12
)

require (
github.com/agnivade/levenshtein v1.2.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.1 // indirect
github.com/defenseunicorns/go-oscal v0.7.2 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect
github.com/gobwas/glob v1.0.0 // indirect
github.com/goccy/go-json v0.10.6 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-containerregistry v0.22.1 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-plugin v1.8.0 // indirect
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/lestrrat-go/blackmagic v1.0.4 // indirect
github.com/lestrrat-go/dsig v1.4.0 // indirect
github.com/lestrrat-go/dsig-secp256k1 v1.0.0 // indirect
github.com/lestrrat-go/httpcc v1.0.1 // indirect
github.com/lestrrat-go/httprc/v3 v3.0.6 // indirect
github.com/lestrrat-go/jwx/v3 v3.3.0 // indirect
github.com/lestrrat-go/option/v2 v2.0.0 // indirect
github.com/mattn/go-colorable v0.1.15 // indirect
github.com/mattn/go-isatty v0.0.22 // indirect
github.com/oklog/run v1.2.0 // indirect
github.com/open-policy-agent/opa v1.22.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/segmentio/asm v1.2.1 // indirect
github.com/sirupsen/logrus v1.10.2 // indirect
github.com/valyala/fastjson v1.6.10 // indirect
github.com/vektah/gqlparser/v2 v2.5.58 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/yashtewari/glob-intersection v0.2.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.28.0 // indirect
go.yaml.in/yaml/v3 v3.0.6 // indirect
golang.org/x/crypto v0.59.0 // indirect
golang.org/x/net v0.62.0 // indirect
golang.org/x/sync v0.25.0 // indirect
golang.org/x/sys v0.50.0 // indirect
golang.org/x/text v0.44.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260819154853-08b0e4226688 // indirect
google.golang.org/grpc v1.85.0 // indirect
)
Loading
Loading