@openreachtech/mentsu-github-actions-inspector
v0.2.0
Published
Inspector for GitHub Actions workflows
Keywords
Readme
mentsu-github-actions-inspector
Inspector for GitHub Actions workflows.
Concept
A lock file written by gh actions-lock pins every action a workflow uses to a commit, while a CI log shows only the tag the workflow names, such as v7.
This package reads that lock file and audits the versions it pins.
| class | what it does |
| :-- | :-- |
| ActionVersionAuditor | Audits whether the version tag the lock records still points at the pinned commit |
| WorkflowFileAuditor | Audits whether the lock lists every workflow file in .github/workflows, and no file that is gone |
Installation
Requires Node.js >=24.19.0.
npm install @openreachtech/mentsu-github-actions-inspectorIt is an ES module ("type": "module"); import it with ESM import syntax.
It reads the tags of each action's repository with git ls-remote --tags, so git has to be available on PATH.
Usage
Audit the versions the lock pins
import {
ActionVersionAuditor,
} from '@openreachtech/mentsu-github-actions-inspector'
const auditor = ActionVersionAuditor.create({
lockFilePath: '.github/workflows/actions.lock',
})
const auditParcel = auditor.auditActionVersion()
process.stdout.write(auditParcel.generateReport())
process.stdout.write('\n')
process.exitCode = auditParcel.decideExitCode()✅️ acme/alpha@v1 resolved as v1.2.3 (0123abc)
⏳️ acme/beta@v2 resolved as v2.0.3 (4567def); newer major: v3
🚨 acme/gamma@v3 resolved as v3.0.0 (89abcde); latest: v3.0.2 (0fedcba)resolved as names the release the pinned commit is, so the report also tells which release each action runs.
A line leads with ✅️ for the latest, ⏳️ for the latest with a newer major available, and 🚨 for a version tag that moved on within the major or could not be confirmed. Only 🚨 fails the process.
The exit code is 0 only when every action is confirmed latest, and 1 otherwise.
Running the script shipped with the package
The package ships the script that runs the audit, so a repository does not need to carry a copy of it. Call it by its path from a script of package.json.
It reads .github/workflows/actions.lock in the working directory. The path is fixed, because gh actions-lock writes the lock there. The script takes no argument. It audits every action the lock pins, then checks that the workflows section of the lock names exactly the .yml and .yaml files in .github/workflows.
{
"scripts": {
"audit:actions": "node node_modules/@openreachtech/mentsu-github-actions-inspector/scripts/audit-action-version.js"
}
}npm run audit:actions✅️ actions/checkout@v7 resolved as v7.0.1 (3d3c42e)
🚨 .github/workflows/release.yml is listed in actions.lock but does not exist
🚨 .github/workflows/deploy.yml exists but is not listed in actions.lockIt ends with 1 when either audit fails, as ActionVersionAuditParcel#decideExitCode() and WorkflowFileAuditParcel#decideExitCode() decide, and 0 otherwise. Regenerate the lock with gh actions-lock --no-narrow to clear a workflow file line.
The package declares no command name on purpose. A command name is resolved through node_modules/.bin/, which every installed package shares, and another package that declares the same name takes it over without any warning. The path names this package alone.
API
Contribution
Bug reports, feature requests, and code contributions are welcome.
Feel free to contact us through GitHub Issues.
git clone https://github.com/openreachtech/mentsu-github-actions-inspector.git
cd mentsu-github-actions-inspector
npm install
npm run lint
npm testLicense
This project is released under the Apache License 2.0.
For more details, please see the LICENSE file.
Developer
Copyright
© 2026 Open Reach Tech Inc.
