From f74e00a38465b19ba20705d1de580ea010a6689c Mon Sep 17 00:00:00 2001 From: Yordis Prieto Date: Mon, 2 Nov 2026 02:44:15 -0500 Subject: [PATCH] feat(repo-health): add repo health action Signed-off-by: Yordis Prieto --- .github/release-please-config.json | 4 + .github/release-please-manifest.json | 3 +- actions/repo-health/README.md | 80 ++++++++++++++++++ actions/repo-health/action.yml | 29 +++++++ actions/repo-health/lib/core.mjs | 65 +++++++++++++++ actions/repo-health/lib/index.mjs | 115 ++++++++++++++++++++++++++ actions/repo-health/lib/main.mjs | 3 + tests/node/repo-health/index.test.mjs | 90 ++++++++++++++++++++ 8 files changed, 388 insertions(+), 1 deletion(-) create mode 100644 actions/repo-health/README.md create mode 100644 actions/repo-health/action.yml create mode 100644 actions/repo-health/lib/core.mjs create mode 100644 actions/repo-health/lib/index.mjs create mode 100644 actions/repo-health/lib/main.mjs create mode 100644 tests/node/repo-health/index.test.mjs diff --git a/.github/release-please-config.json b/.github/release-please-config.json index 3b47994..a2b50ca 100644 --- a/.github/release-please-config.json +++ b/.github/release-please-config.json @@ -47,6 +47,10 @@ "actions/sticky-comment": { "component": "sticky-comment", "initial-version": "0.0.1" + }, + "actions/repo-health": { + "component": "repo-health", + "initial-version": "0.0.1" } }, "plugins": [ diff --git a/.github/release-please-manifest.json b/.github/release-please-manifest.json index 5a1db07..ed0d575 100644 --- a/.github/release-please-manifest.json +++ b/.github/release-please-manifest.json @@ -5,5 +5,6 @@ "actions/stale": "0.0.2", "actions/runs-on-selector": "0.0.1", "actions/terragrunt/report": "0.0.1", - "actions/sticky-comment": "0.0.1" + "actions/sticky-comment": "0.0.1", + "actions/repo-health": "0.0.0" } diff --git a/actions/repo-health/README.md b/actions/repo-health/README.md new file mode 100644 index 0000000..16c3e97 --- /dev/null +++ b/actions/repo-health/README.md @@ -0,0 +1,80 @@ +# repo-health + +Fails unless the repository keeps the practices every repository is expected to +keep. Every check is on by default. The only way past one is to set that +check's own `-skip` input to the reason, so a repository that does not +meet a practice says so in its workflow rather than by leaving the check out. + +## Usage + +```yaml +name: Repo health + +on: + pull_request: + schedule: + - cron: '0 9 1 * *' # monthly, so a repository that has not changed is still checked + workflow_dispatch: + +permissions: {} + +jobs: + repo-health: + runs-on: ubuntu-latest + timeout-minutes: 5 + permissions: + contents: read + steps: + - uses: actions/checkout@ # vX.Y.Z + with: + persist-credentials: false + + - uses: TrogonStack/github-actions/actions/repo-health@ # vX.Y.Z +``` + +The workflow decides when it runs. The action only reads the checkout, so it +gives the same answer however often it is called. + +### Skipping a check + +```yaml + - uses: TrogonStack/github-actions/actions/repo-health@ # vX.Y.Z + with: + citation-cff-skip: internal tooling, nothing to cite +``` + +## Checks + +| Check | Passes when | +| --- | --- | +| `citation-cff` | `CITATION.cff` sits at the repository root under that exact name, with the top-level keys CFF 1.2.0 requires: `cff-version`, `message`, `title`, `authors`. | + +## Inputs + +| Input | Default | Description | +| --- | --- | --- | +| `directory` | `github.workspace` | Root of the checked-out repository. | +| `citation-cff-skip` | empty | Reason to skip `citation-cff`. Empty runs it. | + +## Outputs + +| Output | Description | +| --- | --- | +| `failed` | JSON array of the checks that failed and were not skipped. | + +## Fixed behaviour + +These are not inputs, on purpose. + +- Every check runs unless skipped. A check added in a later version applies to + every consumer as they upgrade, which is the point of keeping them here. +- Each check has its own inputs, named `-