Skip to main content

🏷️ Unified Tag Validation Action

A comprehensive GitHub Action for validating tags across versioning schemes (Semantic Versioning and Calendar Versioning) with cryptographic signature verification (SSH and GPG).

This action unifies and extends the functionality of tag-validate-semantic-action and tag-validate-calver-action.

Features

  • ✅ Semantic Versioning (SemVer) validation
  • ✅ Calendar Versioning (CalVer) validation
  • ✅ SSH signature detection and verification
  • ✅ GPG signature detection and verification
  • ✅ Remote tag validation via GitHub API
  • ✅ Local tag validation in current repository
  • ✅ String validation (no signature check)
  • ✅ Development/pre-release tag detection
  • ✅ Version prefix (v/V) detection
  • ✅ Flexible validation requirements

Quick Start

Check Current Repository Tag Push

name: "Check Tag"
on:
  push:
    tags:
      - '*'

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: "Check pushed tag"
        uses: lfreleng-actions/tag-validate-action@v1
        with:
          require_type: semver
          require_signed: gpg

Check Local Repository Tag

- name: "Check local tag"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: v1.0.0
    require_type: semver
    require_signed: gpg

Check with Gerrit Verification

- name: "Check tag with Gerrit verification"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: v1.0.0
    require_type: semver
    require_signed: gpg
    require_gerrit: 'true'  # Auto-discovers gerrit.[org].org

Check with Both GitHub and Gerrit

- name: "Check tag with dual verification"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: v1.0.0
    require_github: 'true'
    require_gerrit: 'gerrit.onap.org'
    require_owner: 'maintainer@project.org'
    token: ${{ secrets.GITHUB_TOKEN }}

Check Tag String

- name: "Check version string"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_string: "2025.01.15"
    require_type: calver

Inputs

Name Required Default Description
tag_location False '' Path to tag: remote (ORG/REPO/TAG) or local (PATH/TO/REPO/TAG)
tag_string False '' Tag string to check (version format, signature check skipped)
require_type False '' Required tag type: semver, calver, both, none (comma-separated)
require_signed False '' Signature type: gpg, ssh, gpg-unverifiable, unsigned
trusted_gpg_keys False '' ASCII-armoured public GPG key(s); GPG verification uses these keys and no others
require_fingerprint False '' Primary key fingerprint(s) a verified GPG signature must come from (comma or space separated)
permit_expired_key False false Accept a good GPG signature made before its key expired
require_github False false Requires that signing key is registered to a GitHub account
require_gerrit False false Requires that signing key is registered to a Gerrit account (true for auto-discovery, or server hostname)
require_owner False '' GitHub/Gerrit username(s)/email(s) that must own signing key
reject_development False false Reject development/pre-release tags (alpha, beta, rc, dev, etc.)
enforce_increment False false Require tag to be strictly greater than the highest existing tag in the repository
require_branch False '' Require tag commit reachable from a branch (name, or true to auto-detect the default branch)
require_recent False false Require tag created within a time window (true for 3 minutes, or a custom window in minutes); needs an annotated tag
require_latest False false Require tag to point to the current tip commit of the target branch
permit_missing False false Allow missing tags without error
token False '' GitHub token for authenticated API calls and private repo access
github_server_url False '' GitHub server URL (for GitHub Enterprise Server)
debug False false Enable debug output including git error messages

Input Details

tag_location

Specifies a tag to check. Supports two formats:

  1. Remote repository: ORG/REPO/TAG
  2. Local repository: PATH/TO/REPO/TAG

Remote Examples:

  • lfreleng-actions/tag-validate-action/v1.0.0
  • lfreleng-actions/tag-validate-action/2025.01.15

Local Examples:

  • ./my-repo/v1.0.0
  • test-repos/semantic-tags/v2.1.0

For remote tags, the action will:

  1. Attempt to find the tag with the exact name provided
  2. If not found and the tag starts with 'v', try without the 'v' prefix
  3. If not found and the tag doesn't start with 'v', try with 'v' prefix added

For local paths, the repository directory must contain a .git directory.

tag_string

Validates a version string without accessing any repository. Signature checking is not performed in this mode.

Use case: Check version strings before creating tags.

require_type

Enforces the versioning scheme the tag must follow. Accepts comma-separated values.

Version type is always detected and reported in outputs, regardless of this setting. This has negligible performance impact (regex matching, no external calls).

🎯 Version Types

Type Meaning Example
semver Semantic Versioning v1.2.3
calver Calendar Versioning 2024.01.15
both Valid as both 2024.1.0
other Custom format release-2024-q1

Examples:

  • require_type: semver - Requires SemVer
  • require_type: semver,calver - Accepts either SemVer or CalVer
  • require_type: both - Requires tags valid as both SemVer and CalVer
  • require_type: none or omit - Accepts any format (semver, calver, or custom)

Important: When omitted, custom tag formats (type: other) are accepted. This enables signature validation for repositories using custom tagging schemes.

Note: Input is case-insensitive.

require_signed

Controls cryptographic signature types. Accepts comma-separated values.

🔐 Signature Types

Type Meaning Example Use Case
gpg GPG-signed with verifiable signature Production releases
ssh SSH-signed with verifiable signature Development workflows
gpg-unverifiable GPG-signed (verification not required) Legacy signatures
unsigned Must have no signature Lightweight tags
lightweight Lightweight tag (output) Auto-generated tags
invalid Invalid signature (output) Failed verification

Examples:

  • require_signed: gpg - Requires verified GPG signature
  • require_signed: gpg,ssh - Accepts either verified GPG or SSH signature
  • require_signed: unsigned - Requires no signature

Note: Input is case-insensitive. The action skips signature checking when using tag_string mode.

trusted_gpg_keys

ASCII-armoured public GPG key(s), for example a repository variable holding a project's release key. When set, the action writes the keys to a private file under RUNNER_TEMP, verifies the tag against a temporary keyring that holds those keys and nothing else, and removes both afterwards. The runner's default keyring is neither read nor changed, so a key that an earlier step imported cannot make a tag pass.

The action fails before verification when the input holds no public key or holds a secret key. Not supported with tag_string.

require_fingerprint

Primary key fingerprint(s), 40 hex digits each, separated by commas or spaces; case and the spaces in GnuPG's grouped form do not matter. Short and long key IDs are refused, and so is a value of whitespace alone. When set, the tag must carry a verified GPG signature made by one of these keys or one of its subkeys, compared on the primary key fingerprint in full.

The check fails closed: unsigned, lightweight, SSH, gpg-unverifiable and invalid tags all fail, whatever require_signed allows. Without trusted_gpg_keys the action verifies against the default keyring, as before, and still applies the pin. Not supported with tag_string.

permit_expired_key

Default false. A signature from an expired or revoked key, or an expired signature, fails with a message naming the state. When true, one case counts as verified: a good signature from a key that has since expired, dated before the key's expiry. The fingerprint pin still applies, the run prints a ::warning::, and the step summary names the key and its expiry date. A revoked key, an expired signature, a bad signature and a signature dated after the key expired always fail, as does a key that is both expired and revoked. With this option set, the action verifies with the gpg on PATH, ignoring a gpg.program setting, so the expiry and revocation it reads come from the keyring that verified the signature.

With any of trusted_gpg_keys, require_fingerprint or permit_expired_key set, these states fail even when require_signed is unset. With none of them set, require_signed alone decides, as before.

Note: The signature time is the signer's own claim. This option trusts whoever holds the key not to backdate a signature past the key's expiry.

require_github

When set to true, requires that the signing key is registered to a GitHub account. This verifies that the key used to sign the tag is associated with any GitHub user.

Requires: A GitHub token must be provided via the token input.

Example:

- uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_signed: gpg
    require_github: true
    token: ${{ secrets.GITHUB_TOKEN }}

GitHub Username Auto-Detection:

When require_github is enabled but no specific username is provided via require_owner, the action will attempt to automatically detect the GitHub username from the tagger's email address found in the tag signature. If successful, the username will be displayed with an [enumerated] indicator in the output to show auto-detection rather than explicit specification.

Note: Use in combination with require_owner to verify the key belongs to specific GitHub user(s).

GPG keys the runner does not hold: A GPG signature whose public key is not on the runner is gpg-unverifiable. With require_github (or require_owner) set, the action fetches the GPG keys registered to the required owners, or else to the tagger's account, selects the key whose key ID or subkey ID made the signature, and verifies the tag against that key alone in a temporary keyring. On success the tag reports signing_type: gpg with key source github, and still passes a require_signed list that names gpg-unverifiable without gpg. require_fingerprint applies to it like any other verified signature. An email address in require_owner must match the email of the verified signing key, as for a key the runner holds. The tag fails when no account resolves, no registered key matches, GitHub marks the key or its signing subkey revoked, the key has expired (unless permit_expired_key is set) or the signature does not verify. With trusted_gpg_keys set, the action fetches no key from GitHub: a signature the supplied keys do not verify fails require_github.

Behaviour change: Earlier releases skipped the GitHub check for an unverifiable GPG signature, so any GPG-signed tag passed require_github. Such a tag now fails unless its key is registered to the resolved account. A tagger whose email maps to no GitHub account fails too, as for SSH; name the account with require_owner instead.

require_owner

Specifies one or more GitHub usernames or email addresses that must own the signing key. Accepts comma or space-separated values.

When specified, the action verifies that the key used to sign the tag is registered to one of the provided GitHub accounts or email addresses.

Requires: A GitHub token must be provided via the token input.

Examples:

# Single owner by username
- uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_signed: gpg
    require_owner: octocat
    token: ${{ secrets.GITHUB_TOKEN }}
# Two owners (comma-separated)
- uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_signed: gpg
    require_owner: octocat,monalisa
    token: ${{ secrets.GITHUB_TOKEN }}
# Email addresses
- uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_signed: gpg
    require_owner: octocat@github.com,monalisa@example.com
    token: ${{ secrets.GITHUB_TOKEN }}
# Mixed usernames and emails
- uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_signed: gpg
    require_owner: octocat,monalisa@example.com
    token: ${{ secrets.GITHUB_TOKEN }}

Note: When require_owner is specified, require_github is implied and does not need to be set separately.

reject_development

When set to true, the action will reject tags identified as development or pre-release versions.

Development tags are identified by the presence of keywords in the tag name:

  • alpha, beta, rc (release candidate)
  • dev, pre, preview
  • snapshot, nightly, canary

Use cases:

  • Prevent accidental releases from development tags
  • Enforce production deployments
  • Skip CD pipelines for pre-release versions

Examples:

# Reject development tags in production deployment
- name: "Check production tag"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_type: semver
    reject_development: true
# Allow development tags (default behavior)
- name: "Check any tag"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_type: semver
    reject_development: false  # or omit this line

Development tag examples that will be rejected:

  • v1.0.0-alpha
  • v2.1.0-beta.1
  • v3.0.0-rc1
  • 2024.01.15-dev
  • 2025.02.3_rc1
  • v1.2.3-snapshot

Production tag examples that will pass:

  • v1.0.0
  • v2.1.0
  • 2024.01.15

enforce_increment

When set to true, the pushed tag must compare strictly greater than the highest existing comparable tag in the repository. This prevents stale or lower-value tags (for example, tags pushed from an out-of-sync fork) from triggering release/publish pipelines.

Behavior:

  • Repository tags get enumerated using both the GitHub API and local git (union of both sources), so shallow checkouts still work
  • Comparison is scheme-aware: SemVer tags compare using SemVer precedence rules, CalVer tags compare by date (and micro/patch level)
  • The pushed tag gets excluded from the baseline, so re-pushing the current highest tag passes
  • The first version tag in a repository always passes
  • Non-version tags (e.g. latest, some-label) do not contribute to the baseline

Fail-closed behavior (validation fails):

  • The pushed tag does not parse as SemVer or CalVer
  • The pushed tag uses a different versioning scheme than all existing version tags (scheme switching cannot bypass the gate)
  • Repository tags cannot be enumerated from any source

Note: Backport releases (e.g. pushing v1.4.9 when v2.0.0 exists) get blocked when this feature is enabled. Repositories that need backport releases should leave enforce_increment disabled or use a separate workflow for maintenance branches.

Not supported with tag_string (requires a repository context).

Example:

- name: "Check tag increments repository version"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    enforce_increment: true
    token: ${{ secrets.GITHUB_TOKEN }}

require_branch

Requires the tag to point to a commit reachable from the given branch. This prevents releases from unreviewed or orphaned commits.

Accepted values:

  • A branch name (e.g. main, release/2.x)
  • true to auto-detect the repository default branch
  • Empty, false, no, or 0 to disable the check

Behavior:

  • Prefers the GitHub compare API (reliable with shallow checkouts), falling back to local git ancestry checks
  • Fails closed: when containment cannot be determined, validation fails

Not supported with tag_string (requires a repository context).

Example:

- name: "Check tag is on the default branch"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_branch: ${{ github.event.repository.default_branch }}
    token: ${{ secrets.GITHUB_TOKEN }}

require_recent

Requires the tag to have been created within a time window. This prevents accidental pushes of stale tags (e.g. old test tags left in a local clone or fork) from creating faulty releases.

Accepted values:

  • true to use the default 3-minute window
  • A window in minutes (e.g. 10, fractional values allowed)
  • Empty, false, no, or 0 to disable the check

Behavior:

  • Uses the tag object's creation timestamp, so the check needs an annotated (or signed) tag; lightweight tags fail closed because they carry no creation timestamp
  • On a tag push event, measures the age at the moment GitHub received the push (github.event.repository.pushed_at), not when the workflow runs, so delays in GitHub starting the run do not count against the tag. This applies when the validated tag is the pushed tag (GITHUB_REF is refs/tags/<tag>, with no / or @ in the name) and the tag object in the checkout is the one the push delivered (github.event.after); every other case measures against the runner's clock at validation time
  • A workflow re-run replays the original event, so it measures against the original push time: the gate stops stale tags being pushed, and does not penalise slow or repeated runs. A tag replaced since that push is no longer the pushed object, so its re-run measures against the clock
  • A push time more than five minutes after the runner's clock fails closed (the reference cannot be trusted)
  • Timestamps more than five minutes in the future fail closed (the timestamp cannot be trusted)
  • Note: tagger timestamps come from the tag creator's clock and are not tamper-proof; this gate prevents accidental mistakes rather than deliberate forgery. Combine with require_latest for a check that cannot be forged.

Not supported with tag_string (requires a repository context).

Example:

- name: "Check tag was created in the last 3 minutes"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_recent: true
    token: ${{ secrets.GITHUB_TOKEN }}

require_latest

Requires the tag to point to the current tip commit of the target branch. This prevents releases that point to an older commit SHA, e.g. a stale tag pushed from an out-of-date clone.

Behavior:

  • The target branch is require_branch when it names a concrete branch, otherwise the repository default branch
  • Prefers the GitHub API, falling back to git ls-remote against the origin remote; both query the authoritative remote so stale local refs cannot skew the result
  • Fails closed: when the branch tip cannot be determined, validation fails
  • A commit pushed to the branch between tagging and validation makes the check fail; recreate the tag on the new tip

Not supported with tag_string (requires a repository context).

Example:

- name: "Check tag points to the latest commit"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_latest: true
    token: ${{ secrets.GITHUB_TOKEN }}

permit_missing

When set to true, the action will not fail if:

  • No tag exists in the workflow context (not a tag push event)
  • The tag_location specified doesn't exist
  • Empty tag_string provided

The action will still fail if:

  • tag_location format is invalid
  • Required validation checks fail (type or signature mismatch)

token

GitHub token for authenticated API requests and private repository access.

Use cases:

  • Access private repositories via tag_location
  • Increase API rate limits (60/hour → 5,000/hour)
  • Clone repositories requiring authentication

Example:

- uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: "my-org/private-repo/v1.0.0"
    token: ${{ secrets.GITHUB_TOKEN }}

Note: For workflows in the same repository, ${{ secrets.GITHUB_TOKEN }} is automatically available.

github_server_url

GitHub server URL for git operations. Supports GitHub Enterprise Server.

Default behavior:

  1. Uses the provided github_server_url if specified
  2. Falls back to GITHUB_SERVER_URL environment variable
  3. Falls back to https://github.com

Use case: When validating tags from GitHub Enterprise Server instances.

Example:

- uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: "my-org/my-repo/v1.0.0"
    github_server_url: "https://github.enterprise.example.com"

debug

Enable comprehensive debug output in action logs for troubleshooting.

When enabled, the action will output:

  • Bash command tracing: Shows all shell commands being executed (set -x)
  • Python verbose logging: Enables DEBUG level logging from the Python CLI (--verbose)
  • Internal variable values
  • Git command outputs and error messages
  • Tag object inspection details
  • Signature verification details
  • API calls and responses
  • Repository cloning and tag fetching operations

Use case: Diagnosing validation failures or unexpected behavior.

Example:

- uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: "my-org/my-repo/v1.0.0"
    debug: true

Outputs

Name Description
valid Set to true if tag passes all validation checks
tag_type Detected tag type: semver, calver, both, or other
signing_type Signing method used: unsigned, ssh, gpg, gpg-unverifiable, lightweight, or invalid
signing_key_fingerprint Primary key fingerprint of the key behind a verified GPG signature (empty unless verified)
development_tag Set to true if tag contains pre-release/development strings
version_prefix Set to true if tag has leading v/V character
tag_name The tag name under inspection
incremental Set to true if tag increments the repository version (empty when check not performed)
latest_tag Highest existing comparable tag used as the baseline (empty when check not performed)
recent Set to true if tag was created within the require_recent window (empty when not performed)
latest Set to true if tag points to the current branch tip (empty when check not performed)

Exit Codes

When using the Python CLI (tag-validate), the following exit codes are returned:

Exit Code Name Description
0 EXIT_SUCCESS Validation passed
1 EXIT_VALIDATION_FAILED Validation failed (type mismatch, signature requirements not met, etc.)
2 EXIT_MISSING_TOKEN GitHub token required but not provided (when using --require-github)
3 EXIT_INVALID_INPUT Invalid input parameters or malformed arguments
4 EXIT_UNEXPECTED_ERROR Unexpected error during execution
5 EXIT_MISSING_CREDENTIALS Gerrit credentials required but not provided (when using --require-gerrit)
6 EXIT_AUTH_FAILED Gerrit authentication failed (invalid username or password)
7 EXIT_NOT_INCREMENTAL Tag does not increment the repository version (--enforce-increment)
8 EXIT_BRANCH_CHECK_FAILED Tag commit not reachable from the required branch (--require-branch)
9 EXIT_TAG_NOT_RECENT Tag not created within the required time window (--require-recent)
10 EXIT_NOT_LATEST Tag commit is not the current branch tip (--require-latest)

Notes:

  • Exit code 2 (EXIT_MISSING_TOKEN) is specifically returned when:

    • --require-github flag is used but GITHUB_TOKEN environment variable is not set
    • GitHub API access is required but no authentication token is available
  • Exit code 5 (EXIT_MISSING_CREDENTIALS) is returned when:

    • --require-gerrit flag is used but Gerrit credentials are not provided
    • Gerrit server requires authentication but GERRIT_USERNAME or GERRIT_PASSWORD environment variables are not set (and no .netrc entry exists)
  • Exit code 6 (EXIT_AUTH_FAILED) is returned when:

    • Gerrit credentials are provided but authentication fails
    • Username or HTTP password is incorrect
    • Note: Gerrit requires an HTTP password (from Settings > HTTP Credentials), not your SSO/LDAP password
  • Exit code 1 (EXIT_VALIDATION_FAILED) covers all validation failures including:

    • Version type mismatch (e.g., CalVer tag when SemVer required)
    • Signature requirements not met
    • Signing key not registered on GitHub/Gerrit (when --require-github or --require-gerrit is used)
    • Missing username for key verification

Example handling exit codes in CI:

#!/bin/bash

tag-validate verify v1.2.3 --require-github --owner myuser
exit_code=$?

case $exit_code in
  0)
    echo "✅ Validation passed"
    ;;
  1)
    echo "❌ Validation failed"
    exit 1
    ;;
  2)
    echo "❌ GitHub token not provided"
    echo "Set GITHUB_TOKEN environment variable"
    exit 1
    ;;
  5)
    echo "❌ Gerrit credentials not provided"
    echo "Set GERRIT_USERNAME and GERRIT_PASSWORD environment variables"
    exit 1
    ;;
  6)
    echo "❌ Gerrit authentication failed"
    echo "Verify your Gerrit HTTP password (not SSO/LDAP password)"
    exit 1
    ;;
  *)
    echo "❌ Unexpected error (exit code: $exit_code)"
    exit 1
    ;;
esac

Using .netrc Files

Tag-validate supports loading Gerrit credentials from .netrc files, following the standard format used by curl and other tools.

Search order:

  1. .netrc in the current directory
  2. ~/.netrc in your home directory
  3. ~/_netrc (Windows fallback)

Example .netrc file:

machine gerrit.onap.org login myuser password mytoken
machine gerrit.opendaylight.org login myuser password anothertoken

CLI options:

Option Description
--no-netrc Disable .netrc file lookup
--netrc-file PATH Use a specific .netrc file
--netrc-optional Do not fail if .netrc file is missing (default)
--netrc-required Require a .netrc file and fail if missing

By default, .netrc lookup is optional (--netrc-optional): if no .netrc file is found, the tool continues and falls back to environment variables. Use --netrc-required to enforce that a .netrc file must be present.

When a .netrc file is present, credentials load automatically. Explicit environment variables or CLI arguments take precedence over .netrc entries.

Credential Priority Order:

  1. CLI arguments (highest priority)
  2. .netrc file (if not disabled with --no-netrc)
  3. Environment variables (e.g., GERRIT_USERNAME, GERRIT_PASSWORD)

Tag Detection Priority

The action determines which tag to check in the following order:

  1. tag_location - If provided, validates the specified remote tag
  2. tag_string - If provided (and no tag_location), validates the string
  3. Git context - If neither above provided, checks if a tag push started the workflow

If none of the above sources provide a tag:

  • With permit_missing: true - Action succeeds with minimal outputs
  • With permit_missing: false - Action fails with an error

Usage Examples

Enforce SemVer with GPG Signatures

name: "Strict Tag Validation"
on:
  push:
    tags:
      - 'v*'

jobs:
  check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: "Check tag"
        uses: lfreleng-actions/tag-validate-action@v1
        with:
          require_type: semver
          require_signed: gpg

Check CalVer Tags (Any Signature)

- name: "Check CalVer tag"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    require_type: calver
    require_signed: gpg,ssh

Check Remote Tag Before Release

- name: "Check dependency version"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: "my-org/my-dependency/v2.1.0"
    require_type: semver
    permit_missing: false
    token: ${{ secrets.GITHUB_TOKEN }}

Check Version String in CI

- name: "Check version from package.json"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_string: ${{ steps.get_version.outputs.version }}
    require_type: semver

Detect Development Tags

- name: "Check tag and determine if development"
  id: check
  uses: lfreleng-actions/tag-validate-action@v1

- name: "Skip deployment for dev tags"
  if: steps.check.outputs.development_tag == 'true'
  run: echo "Skipping deployment for development tag"

Flexible Validation (No Requirements)

- name: "Detect tag properties"
  id: detect
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    permit_missing: true

- name: "Show tag info"
  run: |
    echo "Tag Type: ${{ steps.detect.outputs.tag_type }}"
    echo "Signing: ${{ steps.detect.outputs.signing_type }}"
    echo "Dev Tag: ${{ steps.detect.outputs.development_tag }}"
    echo "Has Prefix: ${{ steps.detect.outputs.version_prefix }}"

Check Private Repository Tag

- name: "Check private repository tag"
  uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: "my-org/private-repo/v2.0.0"
    require_type: semver
    require_signed: gpg
    token: ${{ secrets.PAT_TOKEN }}  # Personal Access Token with repo scope

Implementation Details

Semantic Versioning (SemVer)

Uses the official regular expression from semver.org:

^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$

Valid examples:

  • 1.0.0
  • v2.3.1
  • 0.1.0-alpha.1
  • 1.0.0-beta+exp.sha.5114f85

Calendar Versioning (CalVer)

Accepts these forms, with an optional v or V prefix:

  • YYYY.MM or YY.MM: a four-digit or two-digit year, then the month
  • YYYY.MM.DD: a third segment of 1 to 31 is a day
  • YYYY.MM.MICRO: a third segment of 0 or above 31 is a micro version
  • YYYY.MM.DD.MICRO: with a fourth segment, the third must be a day of 1 to 31

The month must be 1 to 12, with or without a leading zero, so 2025.13.1 and 2025.00.1 are not CalVer. Any form may end in a modifier introduced by -, . or _, such as -rc.1, .post1 or _post1.

Valid examples:

  • 2025.01.15
  • 2025.02
  • 24.04
  • 25.1.0
  • 2025.1.0
  • 2025.02.3_post1
  • v2025.01.15-beta.1

A tag with a two-digit year, such as 24.4.1, or a tag such as 2025.1.0, is also valid SemVer, so the action reports its tag_type as both. Both require_type: semver and require_type: calver accept it.

Development Tag Detection

Detects common pre-release/development identifiers (case-insensitive):

  • dev
  • pre
  • alpha
  • beta
  • rc
  • snapshot
  • nightly
  • canary
  • preview

Examples:

  • v1.0.0-dev → development_tag: true
  • 2025.01-beta.1 → development_tag: true
  • v1.0.0 → development_tag: false

Signature Detection

The action detects signatures using two methods:

GPG Signatures:

  • Executes git verify-tag --raw <tag>
  • Looks for [GNUPG:] markers (GOODSIG, VALIDSIG, ERRSIG)

SSH Signatures:

  • Checks for SSH-specific markers in verification output
  • Examines tag object for -----BEGIN SSH SIGNATURE----- block

Limitations:

  • Signature checking requires the tag to exist in a git repository
  • The action clones remote tags temporarily for signature verification
  • String validation (tag_string) cannot check signatures

Requirements

Signature Verification Result Codes

Git Verify Result signing_type Description
0 gpg GPG signature verified (GOODSIG or VALIDSIG detected)
non-zero gpg-unverifiable GPG signature present but unverifiable (ERRSIG - missing key)
0 ssh SSH signature verified (pattern match in git verify-tag output or tag object)
non-zero invalid GPG signature present but verification failed (BADSIG - corrupted or tampered)
non-zero lightweight Lightweight tag (no tag object; not signable)
non-zero unsigned Annotated tag object present but no GPG/SSH signature markers detected
non-zero unsigned Tag object unreadable (resolution failure or repository fetch limitation)
non-zero unsigned Tag reference resolution failed (rev-parse returned empty)

Notes:

  • The action first inspects tag object presence (annotated vs lightweight).
  • Git verify result alone does not classify signature state. Output markers (GOODSIG, VALIDSIG, BADSIG, ERRSIG, SSH patterns) determine signing_type.
  • The "Git Verify Result" column shows internal git verify-tag exit codes for reference - signing_type is the actual output exposed by the action.
  • ERRSIG vs BADSIG distinction: ERRSIG (missing key) returns gpg-unverifiable to allow consumers to make informed security decisions; BADSIG (failed verification) returns invalid.
  • A lightweight tag is functionally treated as an unsigned tag for policy enforcement, but surfaced distinctly for clarity.
  • invalid signature states cause failure when require_signed is gpg or ssh.
  • A signature from a revoked or expired key (REVKEYSIG, EXPKEYSIG) or an expired signature (EXPSIG) returns invalid, and the failure names that state. With permit_expired_key: true, a good signature made before its key expired returns gpg.

GitHub API Response Handling

The remote tag existence check uses HTTP status codes (200 success, others treated as missing). A future enhancement will parse the JSON body to distinguish:

  • Permission issues (403) vs true absence (404)
  • Redirect or legacy ref patterns
  • Error payloads indicating rate limiting This planned improvement will allow more precise error messaging and potentially differentiated handling (e.g. retry vs fail-fast).

Git Version

  • Git 2.34 or later required for SSH signing support
  • GitHub Actions runners typically have Git 2.39+

Repository Checkout

For local tag validation (tag push events):

- uses: actions/checkout@v4
  with:
    fetch-depth: 0  # Required to fetch all tags

GitHub Token

For remote tag validation, the action can use authenticated or anonymous API calls:

Without token:

  • Rate limit: 60 requests/hour
  • Cannot access private repositories

With token:

  • Rate limit: 5,000 requests/hour
  • Can access private repositories (with appropriate permissions)

Usage:

- uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: "owner/repo/v1.0.0"
    token: ${{ secrets.GITHUB_TOKEN }}

Validation Logic

Type Validation

require_type tag_type Result
none any ✅ Pass
semver semver ✅ Pass
semver both ✅ Pass
semver calver ❌ Fail
calver calver ✅ Pass
calver both ✅ Pass
calver semver ❌ Fail

Signature Validation

require_signed signing_type Result
ambivalent any ✅ Pass (always)
true ssh/gpg ✅ Pass
true gpg-unverifiable ❌ Fail
true unsigned ❌ Fail
true lightweight ❌ Fail
true invalid ❌ Fail
ssh ssh ✅ Pass
ssh gpg ❌ Fail
ssh gpg-unverifiable ❌ Fail
ssh unsigned ❌ Fail
ssh lightweight ❌ Fail
ssh invalid ❌ Fail
gpg gpg ✅ Pass
gpg gpg-unverifiable ❌ Fail
gpg ssh ❌ Fail
gpg unsigned ❌ Fail
gpg lightweight ❌ Fail
gpg invalid ❌ Fail
false unsigned ✅ Pass
false lightweight ✅ Pass
false ssh ❌ Fail
false gpg ❌ Fail
false gpg-unverifiable ❌ Fail
false invalid ❌ Fail

Security Note: Unverifiable Signatures

Important: When require_signed=gpg, tags with gpg-unverifiable signatures will fail validation. This is a security feature to prevent tags signed with unknown or untrusted keys from bypassing signature requirements.

Why this matters:

  • A gpg-unverifiable signature means the key is not in your keyring
  • This may mean the key is untrusted or compromised
  • For production releases, accept verifiable signatures

With require_github or require_owner set, a gpg-unverifiable signature is verified against the signer's GPG key registered on GitHub (see require_github); a tag that passes this way reports gpg and passes require_signed=gpg-unverifiable, while one whose key is registered to nobody fails.

If you need to allow unverifiable signatures:

  • Omit require_signed (accepts any signature state)
  • Use require_signed=gpg-unverifiable (accepts unverifiable GPG signatures)
  • Or supply the public key with trusted_gpg_keys for verification

Example workflow with a supplied release key:

Pass the public key to the action rather than importing it with gpg --import: any earlier step in the job can add keys to the default keyring, while trusted_gpg_keys verifies against the supplied keys alone. Pin the key's primary fingerprint so that no other key can pass.

- name: Check tag signature
  uses: lfreleng-actions/tag-validate-action@<commit-sha>
  with:
    require_type: semver
    require_signed: gpg
    trusted_gpg_keys: ${{ vars.RELEASE_PUBLIC_KEY }}
    require_fingerprint: '63DDFF3B52B3F1AD3709C15144931D585CCBDA33'

Troubleshooting

"Tag not found" errors

Solution: When validating local tags, ensure:

  1. You check out the repository with fetch-depth: 0
  2. The tag exists in the repository
  3. The tag name is correct (check for v prefix)

Signature verification fails

Possible causes:

  1. Not in a git repository
  2. Tag doesn't exist locally
  3. Using tag_string mode (signatures not checked)

Solution: Use tag push events or tag_location for signature validation.

Rate limiting on remote tags

Solution: Provide GitHub token for higher rate limits:

- uses: lfreleng-actions/tag-validate-action@v1
  with:
    tag_location: "owner/repo/v1.0.0"
    token: ${{ secrets.GITHUB_TOKEN }}

Migration from Previous Actions

This action replaces tag-validate-semantic-action and tag-validate-calver-action. Both legacy actions take the same two inputs, string (required) and exit_on_fail (default 'false'), and set the same two outputs, valid and dev_version, so one guide covers both.

From tag-validate-semantic-action

# Legacy action
- uses: lfreleng-actions/tag-validate-semantic-action@v1
  with:
    string: ${{ github.ref_name }}
    exit_on_fail: 'true'

# Replacement
- uses: lfreleng-actions/tag-validate-action@0000000000000000000000000000000000000000  # REPLACE: vX.Y.Z
  with:
    tag_string: ${{ github.ref_name }}
    require_type: semver

From tag-validate-calver-action

# Legacy action
- uses: lfreleng-actions/tag-validate-calver-action@v1
  with:
    string: ${{ github.ref_name }}
    exit_on_fail: 'true'

# Replacement
- uses: lfreleng-actions/tag-validate-action@0000000000000000000000000000000000000000  # REPLACE: vX.Y.Z
  with:
    tag_string: ${{ github.ref_name }}
    require_type: calver

Pass to tag_string whatever string the legacy step checked; ${{ github.ref_name }} is the common case.

Input Mapping

Legacy input tag-validate-action
string tag_string
exit_on_fail: 'true' require_type: semver or calver: a tag of another type fails the step
exit_on_fail: 'false' (default) None: see Differences

Output Mapping

Legacy output tag-validate-action
valid tag_type, without require_type (see Differences); with it, another type fails the step
dev_version development_tag

Output changes: this action also sets tag_type, version_prefix, tag_name and the other outputs listed under Outputs.

Differences

  1. A failed check fails the step. The legacy actions, by default, report valid: false and carry on. To keep that behaviour, omit require_type and read tag_type. The legacy SemVer valid corresponds to a tag_type of semver or both, the CalVer one to calver or both. Without require_type, valid is true for any format. Setting continue-on-error: true on a step with require_type does not do the same: with tag_string and the default upload_json, a tag of another type can stop the step before it sets any output, which leaves valid empty rather than false.
  2. tag_string checks the format alone. The signature, trusted key, owner, branch, recency and increment checks need a repository: set tag_location, or run on a tag push event without tag_string.
  3. It does more by default. It uploads a JSON artifact (upload_json, default true). When it checks a repository tag, it also writes a job summary (github_step_summary, default true); with tag_string it writes none. Set github_step_summary: false to turn the summary off. With tag_string, the JSON report also supplies tag_type, development_tag, version_prefix and tag_name: with upload_json: false they keep their defaults (unknown, false, false and empty), so keep upload_json enabled when the workflow reads them, as the tag_type route in the first item does.
  4. Its setup is heavier. It sets up Python and uv and installs its own source with the dependencies its uv.lock pins, where the legacy actions ran one bash step.
  5. Classification is not identical. The CalVer action accepts a month of 0 or above 12 (2025.00.1, 2025.13.1); this action does not treat those tags as CalVer. development_tag uses this action's own markers, which also count test.

License

Apache-2.0

Local Testing

You can test the action locally using Nektos/Act before pushing to GitHub:

# Setup (one time)
make install-act
make setup-secrets

# Run quick smoke test
make test-quick

# Run specific test suites
make test-basic
make test-local-tags
make test-signatures
make test-python

# Run all tests
make test-all

Benefits:

  • ✅ Fast feedback loop (no waiting for CI)
  • ✅ No GitHub Actions minutes consumed
  • ✅ Easy debugging with direct container access
  • ✅ Test before pushing commits

See docs/LOCAL_TESTING.md for detailed setup and usage instructions.

Gerrit Integration

This action now supports verifying cryptographic signing keys against Gerrit Code Review servers. This provides enhanced security by ensuring that authorized developers with registered keys can create valid signed tags.

For comprehensive documentation on Gerrit integration, including setup examples, server configuration, and troubleshooting, see:

📖 GERRIT_INTEGRATION.md

Key features:

  • Auto-discovery of Gerrit servers from GitHub organization names
  • SSH and GPG key verification against Gerrit accounts
  • Support for required account owners
  • Combined GitHub + Gerrit verification
  • Works with popular Gerrit instances (ONAP, OpenDaylight, Eclipse, etc.)

Contributing

Contributions are welcome! Please open an issue or pull request.

Before submitting a PR, please:

  1. Test locally with make test-all
  2. Run pre-commit hooks: pre-commit run --all-files
  3. Ensure all tests pass

Metadata

Release files for tag-validate 1.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tag-validate 1.3.0
File Size Uploaded Provenance Actions
tag_validate-1.3.0.tar.gz 158.3 kB With provenance Details for tag_validate-1.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tag-validate 1.3.0
File Interpreter ABI Platform Actions
tag_validate-1.3.0-py3-none-any.whl Python 3 none any Details for tag_validate-1.3.0-py3-none-any.whl

Total release size: 338.2 kB

Release files / tag_validate-1.3.0.tar.gz

Download URL tag_validate-1.3.0.tar.gz
Size 158.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b935a6dd9fac627545c4474f0c811b3e0daf3521c74bb2f3c366645811cafd90
BLAKE2b-256 checksum
How to use checksums
cf936d7d4f20c6337094c3fbb803745a92b1e344c598332d2a9b101825b7705f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Release files / tag_validate-1.3.0-py3-none-any.whl

Download URL tag_validate-1.3.0-py3-none-any.whl
Size 179.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
457dbe09bd3908e805a3ee14ad187b5066ebbc67468668e609a859ec61f4e9e2
BLAKE2b-256 checksum
How to use checksums
f8205b62e8fb202b17a6bc355c7c0659da73cfcf5dfe8a3672b4916a1ed1c263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.12.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

Security for tag-validate 1.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tag_validate-1.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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