Skip to main content

gha-validator

CLI tool to validate GitHub Actions workflows. Flags actions with known published security advisories from the GitHub Advisory Database, outdated action versions, deprecated/unmaintained actions, unpinned mutable refs, and missing permissions: blocks.

Install

pip install gha-validator

For unreleased changes on main, install from git instead:

pip install git+https://github.com/Al1084/GitHub-Actions-Validator.git@main

Usage

gha-validate .github/workflows/*.yml
SEVERITY  CHECK                    FILE    MESSAGE
--------  -----------------------  ------  ---------------------------------------------------------------------------------------------------------------------------
INFO      outdated-action-version  ci.yml  jobs.build.steps[0]: `actions/checkout@v3` is outdated (v7.0.1 available).
WARNING   unpinned-action          ci.yml  jobs.build.steps[1]: `actions/setup-node@main` is not pinned to a version or commit SHA.
INFO      outdated-action-version  ci.yml  jobs.build.steps[2]: `actions/create-release@v1` is outdated (v1.1.4 available).
WARNING   missing-permissions      ci.yml  Workflow does not declare a top-level `permissions` block.
WARNING   deprecated-action        ci.yml  jobs.build.steps[2]: `actions/create-release` is deprecated. Archived by GitHub; use `softprops/action-gh-release` instead.

Security advisories

Every pinned action is checked against the GitHub Advisory Database's published actions-ecosystem advisories. A match is always reported at error severity — GitHub's own critical/high/medium/low label is included in the message, but a low-severity CVE is still a CVE, so it's never downgraded to something that gets silently ignored.

- uses: wktk/conflibot@v1.0.0
SEVERITY  CHECK               FILE    MESSAGE
--------  ------------------  ------  --------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR     security-advisory   ci.yml  jobs.build.steps[0]: `wktk/conflibot@v1.0.0` — [GHSA-2qvg-qr73-mqxp] (critical severity) conflibot vulnerable to command injection via crafted pull request branch names under pull_request_target. fixed in 1.2.1. https://github.com/advisories/GHSA-2qvg-qr73-mqxp

If the pinned version can't be confirmed against the advisory's affected-version range, or no patched version has been published yet, the finding is still reported (without a --fix) rather than silently skipped.

Output format

--format table|json|github, default table.

gha-validate --format json .github/workflows/*.yml
[
  {
    "check": "outdated-action-version",
    "severity": "info",
    "message": "jobs.build.steps[0]: `actions/checkout@v3` is outdated (v7.0.1 available).",
    "file": "ci.yml",
    "line": 7,
    "fix": { "old": "actions/checkout@v3", "new": "actions/checkout@v7.0.1" }
  },
  {
    "check": "unpinned-action",
    "severity": "warning",
    "message": "jobs.build.steps[1]: `actions/setup-node@main` is not pinned to a version or commit SHA.",
    "file": "ci.yml",
    "line": 8,
    "fix": null
  }
]

--format github emits workflow-command annotations that GitHub renders as inline PR annotations:

gha-validate --format github .github/workflows/*.yml
::notice file=ci.yml,line=7::jobs.build.steps[0]: `actions/checkout@v3` is outdated (v7.0.1 available).
::warning file=ci.yml,line=8::jobs.build.steps[1]: `actions/setup-node@main` is not pinned to a version or commit SHA.
::notice file=ci.yml,line=9::jobs.build.steps[2]: `actions/create-release@v1` is outdated (v1.1.4 available).
::warning file=ci.yml::Workflow does not declare a top-level `permissions` block.
::warning file=ci.yml,line=9::jobs.build.steps[2]: `actions/create-release` is deprecated. Archived by GitHub; use `softprops/action-gh-release` instead.

Auto-fix

--fix auto-bumps version pins in place for outdated-action-version and security-advisory findings, scoped to the exact flagged line (won't touch an identical string sitting in a comment or elsewhere in the file). If an action is both outdated and has an advisory on the same line, the advisory's fix wins — its minimal patched version is the smallest change that clears the CVE, versus jumping straight to the latest release.

gha-validate --fix .github/workflows/*.yml
fixed ci.yml: actions/checkout@v3 -> actions/checkout@v7.0.1
fixed ci.yml: actions/create-release@v1 -> actions/create-release@v1.1.4

Exit code is non-zero if any error-severity finding remains.

As a GitHub Action

- uses: Al1084/GitHub-Actions-Validator@v0.2.0
  with:
    paths: .github/workflows/*.yml  # default
    format: github                  # default; table|json|github
    fix: "false"                    # default

No pip install step needed — the action installs itself from its own pinned ref.

As a pre-commit hook

Add to your .pre-commit-config.yaml:

repos:
  - repo: https://github.com/Al1084/GitHub-Actions-Validator
    rev: v0.2.0
    hooks:
      - id: gha-validate

Runs automatically against changed files under .github/workflows/. language: python, so pre-commit builds an isolated environment for it — no separate install step needed.

Checks

  • security-advisory — action is pinned to a version covered by a published GitHub security advisory (always error severity)
  • outdated-action-version — a pinned version tag has a newer release available
  • unpinned-action — pinned to a mutable ref (@main, @master, a branch) instead of a version or commit SHA
  • deprecated-action — action is archived/unmaintained (seed list, growing)
  • missing-permissions — workflow has no top-level permissions: block

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gha_validator-0.2.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gha_validator-0.2.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file gha_validator-0.2.0.tar.gz.

File metadata

  • Download URL: gha_validator-0.2.0.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for gha_validator-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1951649a53365aa44518a6d1ca429b340b83574939ba9b26ec4f731873e18b69
MD5 2033f5f3ba0093332ce8c0f779dbd74b
BLAKE2b-256 a60d98f764796fdd65985829051b436a89b389216110911d101105ca879c0515

See more details on using hashes here.

File details

Details for the file gha_validator-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: gha_validator-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.2

File hashes

Hashes for gha_validator-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64b5d17e7da7d561871fe87e26bc4f3e2a7986b929732a993cdf58c9538307f0
MD5 3a407ac88923e730d9254cabff616590
BLAKE2b-256 95a609c38cb38be7b1ac1305e5f0e64e6456e0fcfd79d05c1280bad3bd5e9372

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page