Skip to content

Prove the GitHub Action end to end: self-test workflow, sticky PR comment, cached store #108

Open

Description

@vsn411

Problem: #106 adds a composite GitHub Action (action.yml), pre-commit hooks and docs/CI.md, but none of it has run in a real pipeline yet. A team that adds uses: secfoo-com/secfoo@main today gets a SARIF upload and a job summary, and that is all: no comment on the pull request, no memory between runs (every job starts with an empty ~/.secfoo, so open/closed lifecycle and "new since last run" never work in CI), and nothing in this repo would catch the action breaking.

Goal: the action is exercised on every PR to this repo, posts one sticky comment on the pull request it reviews, and can keep its findings store between runs.

Build:

  1. Self-test workflow. .github/workflows/action-selftest.yml runs uses: ./ on pull requests against a small fixture (e.g. examples/sample-output/nodegoat as the target is fine, or a two-file fixture under tests/fixtures/ci/). The public repo has no provider key, so add a deterministic fake agent adapter (--agent fake, hidden from secfoo agents unless SECFOO_FAKE_AGENT=1) that returns a canned report from a file. Assert: exit-code, critical/high/medium/low and cost-usd outputs are set; the SARIF validates against the SARIF 2.1.0 JSON schema; exit codes 0, 1, 2 and 3 map correctly (four jobs, one per code); the step summary contains the results table. Fix whatever the self-test turns up in action.yml.
  2. Sticky PR comment. Input comment: true (default true on pull_request events, needs pull-requests: write): the action creates or updates one comment (marker <!-- secfoo -->) with the per-skill table, the gate verdicts, the agent-reported cost, and a link to the code-scanning alerts. Never fail the job because the comment could not be posted (forks have read-only tokens); log a notice instead.
  3. Cached store. Input cache: true restores and saves ~/.secfoo with actions/cache keyed on the repository and branch, so the second run of a PR sees findings as open/closed rather than all-new, and --rescan stays off unless the commit was already scanned. Document the trade-off (the cache holds report text) and the cache-key override.
  4. Lint the YAML. Add actionlint for action.yml, .github/workflows/*.yml and examples/ci/github-actions*.yml to CI.
  5. Docs: docs/CI.md gains the new inputs and a screenshot of the PR comment.

Where to look: action.yml, .github/workflows/ci.yml, docs/CI.md, examples/ci/, src/secfoo/agents/registry.py and base.py (for the fake adapter), src/secfoo/report/sarif.py, tests/conftest.py (fake_popen shows how agents are faked in unit tests today).

Relation: builds on #106 (merge first). Pairs with the baseline work in the diff-aware-scan issue; the comment should show "N new, M in baseline" once that lands.

Done when: the self-test workflow is green on PRs; the four exit-code jobs each assert their code; the SARIF schema check runs in the self-test; a test PR in a scratch repo shows the sticky comment being created and then updated; actionlint runs in CI; docs updated.

Activity

  1. added
    enhancement
    help wanted
    hackathon
    difficulty: medium
    on Nov 15, 2026
  2. niharika3715 commented on Nov 27, 2026

    @niharika3715
    Contributor

    closes issue #108
    created a pr against this issue: #203

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: mediumenhancementhackathonhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions