Run the workflows against this repo on merge and PR - #12
Conversation
This repository ships reusable workflows and had no CI of its own, so nothing was exercised until after it had already landed in every consuming repo - which, since they all reference @main unpinned, meant production was the test environment. Two bugs shipped that way: a documented `allowed_outdated_libraries` input that never existed, and gate steps whose jq check ignored --audit-level entirely. Adds self-scan.yml with two jobs: - secret-scan: calls security.yml on this repo. notify_webhook is off because there is no SECURITY_WEBHOOK_URL secret here and validate-inputs correctly fails when notifications are on without one. scan_filesystem is on, which is safe since those findings are advisory. - lint-workflows: runs actionlint, which validates workflow syntax, expressions and contexts, and runs shellcheck over the inline `run:` scripts - where the real logic in this repo lives. Installed from a pinned release with checksum verification rather than via a third-party action, matching how TruffleHog is installed. Runs on pull_request as well as pushes to main. Catching a problem before the merge is the point, given consumers pick up @main instantly. node-security-dependency-scan.yml is deliberately not called: it runs `npm ci` and this repository has no package.json, so it would fail for reasons unrelated to whether the workflow is correct. Also fixes the one issue actionlint found in existing code - SC2129, individual redirects to $GITHUB_STEP_SUMMARY in the OWASP report step, now a single grouped redirect - so the new job starts green. Verified: actionlint 1.7.12 reports no issues across all four workflow files, and the checksum grep the install step uses was run against the real actionlint release, matching exactly one line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Was push-to-main plus pull_request. Now `branches: ["**"]`, matching how consuming repos call these workflows, so every push exercises them. Dropped the pull_request trigger: with pushes on all branches it only duplicated runs for same-repo branches. The tradeoff is that PRs opened from forks no longer trigger a run, since fork pushes do not fire in the base repo. Worth adding back if this repo ever takes fork contributions. Documented why the jobs use local `./.github/...` references rather than `@main`: GitHub resolves a local reusable-workflow reference against the same commit as the caller, so a branch push tests that branch's copy. Referencing `@main` would silently test the already-merged version and defeat the purpose. Verified rather than assumed. Pushed a scratch branch carrying a marker echo that existed only on that branch, and the marker executed inside the secret-scan job - confirming the called workflow comes from the branch commit, not from main. Scratch branch removed. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Updated per feedback: runs on every branch push, not just on:
push:
branches: ["**"]This matches how consuming repos call these workflows. I dropped the "Can we test the current version always?" — yes, and it already doesThis hinges on the jobs referencing the workflows by local path ( I verified this rather than trusting the docs. Pushed a scratch branch containing a marker that existed only on that branch: The marker executed inside the So the practical effect: push a change to
|
This repository ships reusable workflows and had no CI of its own. Nothing was exercised until after it had already landed in every consuming repo — and since they all reference
@mainunpinned, production was the test environment.Two bugs shipped exactly that way: a documented
allowed_outdated_librariesinput that never existed in the workflow, and gate steps whosejqcheck ignored--audit-levelentirely.What runs
secret-scan— callssecurity.ymlon this repo. Dogfooding: if the scanner breaks, it breaks here first.notify_webhook: false— there is noSECURITY_WEBHOOK_URLsecret in this repo, andvalidate-inputscorrectly fails when notifications are on without one.scan_filesystem: true— safe, because those findings are advisory and cannot block.lint-workflows— runsactionlint, which validates workflow syntax, expressions and contexts, and runsshellcheckover the inlinerun:scripts. That last part matters most here: the real logic in this repo lives in shell inside YAML, which nothing else checks.It installs from a pinned release with checksum verification rather than pulling a third-party action — consistent with how TruffleHog is installed in
security.yml, and with this repo's own rule about not trusting mutable refs inside a security pipeline.Triggers
pushtomainandpull_request. You asked for merges to main; I added PR runs too, because catching a break before it merges is the actual goal — consumers pick up@mainthe instant it lands, so a post-merge signal is already too late. Happy to drop the PR trigger if you'd rather keep it to main only.What is deliberately not run
node-security-dependency-scan.ymlis not called. It runsnpm ci, and this repository has nopackage.json, so it would fail for reasons that say nothing about whether the workflow is correct. Worth revisiting if a fixture project is ever added here.One existing issue fixed
actionlint found SC2129 in
node-security-dependency-scan.yml— individual redirects to$GITHUB_STEP_SUMMARYin the OWASP report step. Converted to a single grouped redirect so the new lint job starts green rather than red on arrival.Verification
I ran actionlint locally rather than assuming it would pass:
And confirmed the install step's checksum grep against the real actionlint release:
Note this PR is the first real test of itself — the
pull_requesttrigger means both jobs should run on this very PR.Kept separate from #11 (README rewrite) so that one stays docs-only.