Skip to content

feat: add GitHub Action and Docker support - #72

Merged
pixincreate merged 31 commits into
masterfrom
feat/github-action-docker
Aug 2, 2026
Merged

feat: add GitHub Action and Docker support#72
pixincreate merged 31 commits into
masterfrom
feat/github-action-docker

Conversation

@pixincreate

Copy link
Copy Markdown
Owner

Summary

Adds the infrastructure for running KeyWatch in CI/CD environments.

Changes

GitHub Action (.github/actions/keywatch-scan/action.yml)

Composite action that installs and runs key-watch with configurable inputs:

  • paths - files or directories to scan (default: .)
  • exit-mode - strict (default), critical, or always
  • output - path for JSON report
  • verbose - detailed console output
  • Downloads binary from GitHub releases if not pre-installed
  • Exposes findings-count and exit-code outputs
  • Writes summary step to $GITHUB_STEP_SUMMARY

Dockerfile

Multi-stage build:

  • Build: rust:1.85-alpine with musl target
  • Runtime: alpine:3.21 with ca-certificates
  • Bundles detectors.toml at /etc/keywatch/detectors.toml
  • Respects KEYWATCH_CONFIG_PATH env var

Docker Publish Workflow

  • Triggered on `v*' version tags or manual dispatch
  • Builds and pushes to ghcr.io/pixincreate/keywatch
  • Tags: semver (1.2.0, 1.2), short SHA

Usage

- uses: pixincreate/KeyWatch/.github/actions/keywatch-scan@master
  with:
    paths: './src'
    exit-mode: 'critical'
docker run ghcr.io/pixincreate/keywatch:latest scan /workspace

Closes the Action and Docker items from #71.

- Improve OpenAI API key regex (word boundaries, 48+ chars)
- Add OpenCode API key detector (context-based sk- prefix)
- Add 63+ new prefix-based detectors covering:
  - AI services (Anthropic, Cohere, HuggingFace, Mistral, Groq, Replicate, LangSmith)
  - Cloud/Infra (Vercel, Netlify, Supabase, Convex)
  - Monitoring (Datadog, New Relic, PagerDuty, Sentry, Elastic)
  - DevOps (GitLab PATs, Buildkite, TravisCI, Ngrok)
  - Messaging (Confluent)
  - Productivity (Airtable, HashiCorp Vault, Terraform)
- Remove redundant context-based 32-hex detectors (covered by GenericKeyValueDetector)
- Strip verbose descriptions from detectors.toml
- Fix justfile trailing newline

Refs: #57
- Add Critical variant to Severity enum
- Update from_string() to parse CRITICAL
- Update get_severity_counts() to return 4-tuple (critical, high, medium, low)
- Update calculate_exit_code() to treat Critical like High in critical mode
- Update severity display output to include CRITICAL count
- Update tests for new 4-tuple format

Fixes part of #68
- Add baseline module (src/baseline.rs) with JSON serialization
- Add --baseline <path> flag to suppress known findings
- Add --update-baseline flag to write baseline from current scan
- Baseline matching uses file_path + line_number + finding_type + plugin_name
- Integration tests for filtering, save/load, and from_findings

Refs #68
- .github/actions/keywatch-scan/action.yml: composite action that downloads
  and runs key-watch on specified paths with configurable exit mode
- Dockerfile: multi-stage build (rust:alpine → alpine:3.21 runtime)
- .dockerignore: exclude build artifacts and non-essential files
- .github/workflows/docker-publish.yml: build & push to GHCR on version tags
@pixincreate
pixincreate changed the base branch from master to feat/missing-features July 30, 2026 16:32
@pixincreate
pixincreate force-pushed the feat/github-action-docker branch from f15a9b6 to 2e62f03 Compare July 30, 2026 16:32
* origin/master:
  chore(deps): bump toml from 1.1.3+spec-1.1.0 to 1.1.4+spec-1.1.0 (#70)
…/github-action-docker

* origin/feat/missing-features:
  docs(changelog): add PR review fix entries
  chore(deps): bump toml from 1.1.3+spec-1.1.0 to 1.1.4+spec-1.1.0 (#70)

# Conflicts:
#	CHANGELOG.md
…to scratch

- docker-publish.yml: actions/checkout v4→v7, login-action v3→v4.6.0,
  metadata-action v5→v6.2.0, build-push-action v6→v7.3.0
- ci.yml, release.yml: actions/checkout v4→v7
- Dockerfile: runtime stage alpine→scratch (static musl binary),
  numeric USER 65532:65532, absolute ENTRYPOINT path
…/github-action-docker

* origin/feat/missing-features:
  refactor: use const for baseline version and domain separator, rename severity param
- Dockerfile: install git + ca-certificates on alpine:3.23 runtime so
  --git-history scanning and hook installation work in the container
- Dockerfile: copy templates/ (build was missing them, failed at compile)
- Dockerfile: bump build stage to rust:1.97.1-alpine (let-chains in
  scanner.rs require rust >= 1.88)
- ci.yml: crate-ci/typos master -> v1.48.0, Swatinem/rust-cache v2.7.0 -> v2.9.1
- release.yml: softprops/action-gh-release v1 -> v3.0.2

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Not ready to approve

The new composite action and Docker publish workflow contain functional issues (verbose flag always enabled, platform/asset resolution and install assumptions, and an unused workflow_dispatch input) that can break CI/CD usage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Adds CI/CD infrastructure for KeyWatch by introducing a composite GitHub Action for scanning, a multi-stage Docker image build, and a GHCR publish workflow, plus workflow/version updates and documentation entries.

Changes:

  • Added a composite GitHub Action (.github/actions/keywatch-scan/action.yml) to install and run key-watch with configurable inputs and outputs.
  • Added container support via a multi-stage Dockerfile and a new .dockerignore.
  • Added a Docker publish workflow to push images to GHCR; updated existing CI/release workflows to newer action versions.
File summaries
File Description
Dockerfile Adds multi-stage build/runtime containerization for key-watch and bundles detectors.toml.
CHANGELOG.md Documents the new GitHub Action and Docker-related additions/changes.
.github/workflows/release.yml Updates action versions used in the release pipeline.
.github/workflows/docker-publish.yml Introduces GHCR Docker image build/publish workflow on tags/manual dispatch.
.github/workflows/ci.yml Updates action versions used in CI (checkout, typos, rust-cache).
.github/actions/keywatch-scan/action.yml Introduces a composite Action to download/install key-watch and run scans with outputs/summary.
.dockerignore Optimizes Docker build context by excluding git metadata, build output, and misc files.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 6
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread .github/actions/keywatch-scan/action.yml Outdated
Comment thread .github/actions/keywatch-scan/action.yml Outdated
Comment thread .github/actions/keywatch-scan/action.yml Outdated
Comment thread Dockerfile Outdated
Comment thread Dockerfile Outdated
Comment thread .github/workflows/docker-publish.yml
@pixincreate
pixincreate force-pushed the feat/github-action-docker branch from 7e20919 to e543e6d Compare August 1, 2026 18:28
@pixincreate
pixincreate force-pushed the feat/github-action-docker branch from e543e6d to 699f621 Compare August 1, 2026 18:52
* feat/missing-features:
  style: use descriptive scanner test errors
  refactor: simplify baseline hashing
  refactor: clarify pre-push remote policy shell
Base automatically changed from feat/missing-features to master August 2, 2026 08:05
@pixincreate
pixincreate force-pushed the feat/github-action-docker branch from 7f6ea7a to 26287b8 Compare August 2, 2026 08:19
@pixincreate pixincreate self-assigned this Aug 2, 2026
@pixincreate pixincreate added the enhancement New feature or request label Aug 2, 2026
@pixincreate
pixincreate merged commit 101927d into master Aug 2, 2026
5 checks passed
@pixincreate
pixincreate deleted the feat/github-action-docker branch August 2, 2026 08:23
@pixincreate
pixincreate restored the feat/github-action-docker branch August 2, 2026 08:23
@pixincreate
pixincreate deleted the feat/github-action-docker branch August 2, 2026 08:35
@pixincreate
pixincreate restored the feat/github-action-docker branch August 2, 2026 08:38
@pixincreate
pixincreate deleted the feat/github-action-docker branch August 2, 2026 09:21
@pixincreate
pixincreate restored the feat/github-action-docker branch August 2, 2026 09:21
@pixincreate
pixincreate deleted the feat/github-action-docker branch August 2, 2026 09:22
@pixincreate pixincreate added the clanker changes done by ai under author's supervision. label Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clanker changes done by ai under author's supervision. enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants