A GitHub Action that fails if the given version tag already exists in the repository, preventing accidental re-use of already published versions.
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- name: Check if image version is available
uses: gi-org-pl/check-version-action@v1
with:
version: '1.0.0'| Input | Description | Required |
|---|---|---|
version |
Version tag to check (e.g. 1.0.0) |
Yes |
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 }}- name: Check if image version is available
uses: gi-org-pl/check-version-action@v1
with:
version: "$(jq -r '.version' package.json)"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.
Action author is Oskar Barcz, CTO of Generacja Innowacja — Poland's first technology-first NGO.
MIT