Skip to content

feat: enforce workflow naming, dead-input detection, and template compatibility - #529

Open
mkolasinski-splunk wants to merge 2 commits into
developfrom
ai-readiness/level-2
Open

feat: enforce workflow naming, dead-input detection, and template compatibility#529
mkolasinski-splunk wants to merge 2 commits into
developfrom
ai-readiness/level-2

Conversation

@mkolasinski-splunk

Copy link
Copy Markdown
Contributor

Summary

  • Adds two custom, CI-only pre-commit hooks (stages: [manual], run explicitly in .github/workflows/build-test-release.yaml's pre-commit job — never triggered by a local git commit), addressing the agent-readiness Level 2 naming_consistency and dead_code_detection criteria that no off-the-shelf GitHub Actions tool covers:
    • workflow-hygiene (scripts/check_workflow_hygiene.py): enforces kebab-case naming on job ids and workflow_call inputs, and flags declared inputs/secrets never referenced in the reusable workflow.
    • template-compat (scripts/check_template_compat.py): reads a new .github/template-compatibility.yml declaring which refs of splunk/addonfactory-repository-template this reusable workflow is compatible with, fetches each ref's caller workflow (adjust/.github/workflows/build-test-release.yml), and asserts every secret/input it passes is declared here and every required input is supplied.
  • Renames the three job ids that deviated from the repo's kebab-case convention now that it's enforced: review_secretsreview-secrets, UI-tests-reportui-tests-report, Modinput-tests-reportmodinput-tests-report. None are referenced via needs.<id>.outputs or known as branch-protection required-check names, so this is safe.
  • Minor: .github/CODEOWNERS now covers /scripts/; .gitignore ignores __pycache__/.

Important: this will fail CI until a companion template PR merges

template-compat already found a real, pre-existing drift: the template's develop caller still passes GH_TOKEN_ADMIN, a secret this reusable workflow already stopped declaring. That's exactly what template PR splunk/addonfactory-repository-template#919 fixes.

Until #919 merges, this repo's own pre-commit CI job will report failure on every push/PR to develop (by design — the check is honestly reporting the drift). Recommended merge order: merge template PR #919 first, then merge this PR.

Test plan

  • pre-commit run --all-files — confirms workflow-hygiene/template-compat do NOT run at default stage (CI-only, no local-commit friction).
  • pre-commit run workflow-hygiene --hook-stage manual --all-files — passes on the renamed workflow.
  • Regression-tested workflow-hygiene by temporarily injecting a snake_case job id and an unused input — both correctly flagged, then reverted.
  • GH_TOKEN=$(gh auth token) pre-commit run template-compat --hook-stage manual --all-files — correctly fails today with the GH_TOKEN_ADMIN drift described above; will pass once template PR #919 merges.
  • actionlint on both modified workflow files — no new errors (pre-existing client-id/app-id schema warnings are a local actionlint-version mismatch already present on develop, not introduced here; CI's pinned actionlint v1.6.26 doesn't flag them).
  • Grepped for stray references to the old job ids — none remain.

🤖 Generated with Claude Code

…e compat

Adds two custom pre-commit hooks (stages: [manual], wired into the repo's own
pre-commit CI job so they never run on a local commit):

- workflow-hygiene: enforces kebab-case naming on job ids and workflow_call
  inputs, and flags declared inputs/secrets that are never referenced in the
  reusable workflow. Addresses the agent-readiness naming_consistency and
  dead_code_detection Level 2 criteria, which no off-the-shelf GHA tool covers.

- template-compat: declares, via .github/template-compatibility.yml, which
  refs of splunk/addonfactory-repository-template this reusable workflow is
  compatible with, then fetches each ref's caller workflow and asserts every
  secret/input it passes is declared here, and every required input is
  supplied. This already caught a real drift: the template's develop caller
  still passes GH_TOKEN_ADMIN, which this workflow stopped declaring (being
  fixed in template PR #919) -- CI here will go red until that PR merges.

Also renames the three job ids that deviated from the otherwise consistent
kebab-case convention (review_secrets, UI-tests-report, Modinput-tests-report)
now that the naming hook enforces it; none are referenced via needs.<id>
outputs or branch-protection required-check names, so the rename is safe.

Co-Authored-By: Claude <noreply@anthropic.com>
@mkolasinski-splunk
mkolasinski-splunk requested a review from a team as a code owner July 24, 2026 09:52

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0105402451

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +47 to +50
- name: Run CI-only template compatibility hook
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: pre-commit run template-compat --hook-stage manual --all-files

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid running PR-controlled hooks with the app token

On pull_request runs where repository/org secrets are available, this step executes pre-commit from the checked-out PR while GH_TOKEN contains a freshly minted GitHub App token for addonfactory-repository-template. A PR can change .pre-commit-config.yaml or scripts/check_template_compat.py so this command runs attacker-controlled code with whatever permissions that app token has on the template repo; run this check only on trusted refs or execute a pinned/base-revision script before exposing the token.

Useful? React with 👍 / 👎.

Closes the Level 1 agent-readiness blockers from the readiness report:
routes agents to README/runbooks/scripts, documents all 16 workflow_call
secrets, and defines the local validation/build entrypoint and a
change-class to validation-depth table.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant