https://github.com/mdb/ensure-unpublished-release-action
A GitHub Action that checks whether a given GitHub release tag does not already exist.
https://github.com/mdb/ensure-unpublished-release-action
github-actions github-releases typescript
Last synced: 3 months ago
JSON representation
A GitHub Action that checks whether a given GitHub release tag does not already exist.
- Host: GitHub
- URL: https://github.com/mdb/ensure-unpublished-release-action
- Owner: mdb
- License: mit
- Created: 2021-11-06T11:35:59.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2026-03-05T04:13:38.000Z (3 months ago)
- Last Synced: 2026-03-05T09:37:34.133Z (3 months ago)
- Topics: github-actions, github-releases, typescript
- Language: TypeScript
- Homepage:
- Size: 4.76 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/mdb/ensure-unpublished-release-action/actions/workflows/test.yml)
# ensure-unpublished-release-action
A GitHub Action that checks if a given GitHub release tag already exists.
In default configuration, `ensure-unpublished-release-action` succeeds if the
provided release tag is unique and does not already exist, and fails if the tag
has already been published as a GitHub release.
The action produces an `exists` output whose value is `true` or `false`.
## Usage
```yaml
- uses: mdb/ensure-unpublished-release-action
with:
# Required; a GitHub release tag (typically the release name).
#
# Example:
# tag: ${{ env.VERSION }}
tag:
# Required; a GitHub access token (typically `secrets.GITHUB_TOKEN`).
#
# Example:
# token: ${{ secrets.GITHUB_TOKEN }}
token:
# Optional; if the specified skip-commit-message-pattern is present in the
# specified commit-message, do not fail, regardless of whether the release
# exists or not.
# If set, requires commit-message.
#
# Example:
# skip-commit-message-pattern: [skip ensure-version]
skip-commit-message-pattern:
# Optional; the commit message (typically ${{ github.event.head_commit.message }}).
# Required if skip-commit-message-pattern is set.
#
# Example:
# commit-message: ${{ steps.commit-details.outputs.commit-message }}
commit-message:
# Optional; If any of the specified newline-separated list of skip-authors
# matches the specified author, do not fail, regardless of whether the release
# exists or not.
#
# Example:
# skip-authors: |
# dependabot[bot]
# Ian Mackaye
# Jeff Nelson
skip-authors:
# Optional; the commit author.
# Required if skip-authors is set.
#
# Example:
# author: ${{ steps.commit-details.outputs.author }}
author:
```
## Example
```yaml
name: Check that release version does not already exist
on:
pull_request:
jobs:
ensure-unpublished-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Get package.json version
run: echo "PACKAGE_VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
# Fail the build if package.json's 'version' property specifies
# a value associated with an already-existing release:
- uses: mdb/ensure-unpublished-release-action@v1
with:
tag: ${{ env.PACKAGE_VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
```
Example failure:

See `ensure-unpublished-release-action`'s own `.github/workflows` for an additional example.
## Development
Install dependencies:
```
npm install
```
Format code, lint, compile TypeScript, package code for distribution, and run tests:
```
npm run all
```