Skip to content

gi-org-pl/check-version-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

check-version-action

A GitHub Action that fails if the given version tag already exists in the repository, preventing accidental re-use of already published versions.

Requirements

This action requires a full git history to reliably fetch all tags. Make sure your checkout step has fetch-depth: 0 set:

- uses: actions/checkout@v4
  with:
    fetch-depth: 0

Usage

- name: Check if image version is available
  uses: gi-org-pl/check-version-action@v1
  with:
    version: '1.0.0'

Inputs

Input Description Required
version Version tag to check (e.g. 1.0.0) Yes

Example workflow

name: PR Sanity Checks

on:
  pull_request:

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

      - name: Check if image version is available
        uses: gi-org-pl/check-version-action@v1
        with:
          version: ${{ inputs.version }}

Reading version from package.json

- name: Check if image version is available
  uses: gi-org-pl/check-version-action@v1
  with:
    version: "$(jq -r '.version' package.json)"

How it works

The action checks whether the provided version string already exists as a git tag using git tag -l. It also detects shallow clones and fails early with a descriptive error if fetch-depth: 0 was not set, preventing false-negatives.

Authors

Action author is Oskar Barcz, CTO of Generacja Innowacja — Poland's first technology-first NGO.

License

MIT

About

A GitHub Action that fails if the given version tag already exists in the repository, preventing accidental re-use of already published versions.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages