Repository navigation
Add a check for outdated actions from the actions organization - #3460
fulldecent wants to merge 2 commits into
Conversation
script/check-outdated-actions exits 1 when a workflow uses an actions/* reference that is behind a stable release. A major reference such as v5 fails when v6 or later is published. A minor reference such as v5.2 fails when v5.3 or a later major is published. A patch reference fails when any newer stable release is published. The highest release is the highest version number, because the Releases API returns publish order. actions/cache published v5.1.0 after v6.1.0. .github/workflows/check-outdated-actions.yaml runs the script on push and pull request. Refs: actions#3091
|
This is the validation half of #3091. #3091 is the version update for actions in the Please merge this check first, with the failing run. I will bring the version updates in after the check is on |
|
@elbrenn @cannist @jsoref @tsusdere @AnthonyZavala I went through the commit history for the people who have already landed this kind of change. @jsoref updated the workflows to This pull request adds the check. A Is this check a good idea to merge before those version updates? The failing run is the current state of the workflow files. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Address the workflow credential exposure and checker correctness issues before approval.
Review effort: Lite
Findings: 1
Open (2)
What changed in this PR
Adds a TypeScript CI check that detects outdated actions/* references using GitHub release metadata.
Changes:
- Adds version, tag, and SHA validation logic.
- Documents checker behavior and pinning rules.
- Adds Node/TypeScript configuration and locked dependencies.
- Adds a push and pull-request workflow to run the check.
| File | Description |
|---|---|
script/check-outdated-actions/tsconfig.json |
Configures TypeScript compilation. |
script/check-outdated-actions/README.md |
Documents usage and version/SHA rules. |
script/check-outdated-actions/package.json |
Defines checker dependencies and scripts. |
script/check-outdated-actions/package-lock.json |
Locks Node.js dependencies. |
script/check-outdated-actions/index.ts |
Scans workflows and validates action references. |
.github/workflows/check-outdated-actions.yaml |
Runs the checker on pushes and pull requests. |
Files not reviewed (1)
- script/check-outdated-actions/package-lock.json: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| - name: Check action versions | ||
| working-directory: ./script/check-outdated-actions | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: | | ||
| npm ci | ||
| npx ts-node ./index.ts |
| if (isOutdated(resolved, newest)) { | ||
| return finding(reference, behind(`${reference.uses} (${resolved.tag})`, newest)); | ||
| } |
…t release npm ci runs in its own step. GITHUB_TOKEN is set only on the checker step, so a pull request cannot read the token from an install script. A commit SHA with no version comment is current only when that commit is the highest stable release. A release tag of v5 or v5.2 no longer hides a newer release on the same line.
|
Some github actions have not been able to update because of GHES. Beyond that, this repository doesn't really accept contributions (I have 10 outstanding: https://github.com/actions/starter-workflows/pulls?q=is%3Apr+state%3Aopen+author%3Ajsoref), and it really isn't likely to accept workflow changes from external contributors. |
Thank you for your note. Are you saying that some of the actions (only Microsoft supported dependencies are in scope) do not run on GHES? If so, is there a clean way to detect those? |
|
it isn't a strong claim. But https://github.com/actions/download-artifact#ghes-support seems to support the idea. I don't work for MS/GitHub, so I can't really say much about the details, and I don't use GHES. I think the general problem is that GHES's supported platforms include some really old things that don't include modern versions of node, but I'm not really sure. I had hoped that it'd have been resolved by now. |


Summary
This pull request is the validation half of #3091.
#3091 updates workflow files to newer releases of actions in the
actionsorganization. This pull request adds the check those updates are for.script/check-outdated-actionsexits 1 when a workflow depends on an older stable release than the one GitHub has published..github/workflows/check-outdated-actions.yamlruns that script on every push and pull request. The rule is written up inscript/check-outdated-actions/README.md.The version the workflow wrote down is what gets compared:
actions/checkout@v5is an error when a v6 release exists. It stays current through later v5 patch releases, because thev5tag moves.actions/cache@v5.2is an error when a v5.3 release exists. A later major release is also an error. A later v5.2 patch is not, because thev5.2tag moves.actions/setup-python@v5.2.1is an error when any newer stable release exists.That is the tag scheme in Using immutable releases and tags to manage your action's releases. The highest release is the highest version number. The Releases API returns the release that was published most recently, and those are different orderings:
actions/cachepublishedv5.1.0afterv6.1.0.A commit SHA uses the version comment beside it (
# v4.2.2is a patch pin,# actions/checkout@v4is a major pin). A commit SHA with no version comment is current only when that commit is the highest stable release. I checkedactions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11in the policy-validator workflows: that commit isv4.1.1.Running the script on this branch reports 275 references behind a published release, out of 289 references to 20 actions. References that are current include
actions/deploy-pages@v5,actions/jekyll-build-pages@v1,actions/setup-haskell@v1, andactions/checkout@v7incode-scanning/codeql.yml. The new workflow pinsactions/checkout@v7andactions/setup-node@v7, which are the current major tags.The new check fails on this pull request. That failure is the report of the references above. I want this check reviewed and merged before the workflow files are updated. #3091 is that update, and it should land after this check is on
main.Please merge this with the failing check.
Pre-requisites
Not applicable. This pull request does not add a starter workflow. It adds a repository CI script.
Please note that at this time we are only accepting new starter workflows for Code Scanning. Updates to existing starter workflows are fine.
Tasks
The checklist below describes a starter workflow. This pull request adds
script/check-outdated-actionsand the workflow that runs it,.github/workflows/check-outdated-actions.yaml.For all workflows, the workflow:
Should be contained in a
.ymlfile with the language or platform as its filename, in lower, kebab-cased format (for example,docker-image.yml). Special characters should be removed or replaced with words as appropriate (for example, "dotnet" instead of ".NET").Not applicable to a starter-workflow filename. The CI workflow file is
.github/workflows/check-outdated-actions.yaml.Should use sentence case for the names of workflows and steps (for example, "Run tests").
The workflow name is "Check for outdated actions". The step name is "Check action versions".
Should be named only by the name of the language or platform (for example, "Go", not "Go CI" or "Go Build").
Not applicable. This is repository CI, not a starter workflow.
Should include comments in the workflow for any parts that are not obvious or could use clarification.
The workflow file points at
script/check-outdated-actions/README.md, which is where the version rule is written down. The non-obvious part is that a major tag such asv5is current until a later major exists, including whilev5patch releases continue.Should specify least privileged permissions for
GITHUB_TOKENso that the workflow runs successfully.The job sets
permissions: contents: read. The token is passed to the script so it can read public releases ofactions/*repositories.For CI workflows, the workflow:
Should be preserved under the
cidirectory.Not applicable. This file is the repository's own CI, under
.github/workflows.Should include a matching
ci/properties/*.properties.jsonfile (for example,ci/properties/docker-publish.properties.json).Not applicable. This is not a starter workflow.
Should run on
pushtobranches: [ $default-branch ]andpull_requesttobranches: [ $default-branch ].The workflow runs on
pushandpull_requestwith no branch filter, matching.github/workflows/validate-data.yaml.Packaging workflows should run on
releasewithtypes: [ created ].Not applicable.
Publishing workflows should have a filename that is the name of the language or platform, in lower case, followed by "-publish" (for example,
docker-publish.yml).Not applicable.
For Code Scanning workflows, the workflow:
Should be preserved under the
code-scanningdirectory.Not applicable.
Should include a matching
code-scanning/properties/*.properties.jsonfile (for example,code-scanning/properties/codeql.properties.json), with properties set as follows:Not applicable.
name: Name of the Code Scanning integration.creator: Name of the organization/user producing the Code Scanning integration.description: Short description of the Code Scanning integration.categories: Array of languages supported by the Code Scanning integration.iconName: Name of the SVG logo representing the Code Scanning integration. This SVG logo must be present in theiconsdirectory.Should run on
pushtobranches: [ $default-branch, $protected-branches ]andpull_requesttobranches: [ $default-branch ]. We also recommend ascheduletrigger ofcron: $cron-weekly(for example,codeql.yml).Not applicable.
Some general notes:
This workflow must only use actions that are produced by GitHub, in the
actionsorganization, orThis workflow must only use actions that are produced by the language or ecosystem that the workflow supports. These actions must be published to the GitHub Marketplace. We require that these actions be referenced using the full 40 character hash of the action's commit instead of a tag. Additionally, workflows must include the following comment at the top of the workflow file:
The new workflow uses
actions/checkout@v7andactions/setup-node@v7.Automation and CI workflows should not send data to any 3rd party service except for the purposes of installing dependencies.
The script reads public release metadata from
api.github.comfor repositories in theactionsorganization.npm ciinstalls the script's dependencies from the npm registry.Automation and CI workflows cannot be dependent on a paid service or product.