https://github.com/metamask/action-is-release
https://github.com/metamask/action-is-release
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/metamask/action-is-release
- Owner: MetaMask
- License: mit
- Created: 2022-07-28T19:25:49.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T21:43:53.000Z (almost 2 years ago)
- Last Synced: 2025-06-05T10:50:31.238Z (8 months ago)
- Language: Shell
- Size: 17.6 KB
- Stars: 6
- Watchers: 32
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# action-is-release
## Description
Check whether the current commit is a release commit. Primarily this action looks at the `.version` key in a repository's `package.json` to see whether it has changed. Optionally, it can also validate that the commit message starts with a specific string.

## Usage
## Basic usage
This will look at the current commit, comparing it to `github.event.before` to see whether the `version` field of the `package.json` file in the root directory of the repository has changed. If the version has been updated, `IS_RELEASE` will be set to `true`. Otherwise, it will be set to `false`.
```yaml
jobs:
is-release:
outputs:
IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
runs-on: ubuntu-latest
steps:
- uses: MetaMask/action-is-release@v2
id: is-release
```
### Filter by merge commit author
Here is an example of how to use this action with a merge author filter. This will act the same as the previous example, except that it will be skipped if the commit author is anyone other than "GitHub". When skipped, `IS_RELEASE` will be unset.
```yaml
jobs:
is-release:
# Filter by commits made by the author "github-actions"
if: github.event.head_commit.author.name == 'github-actions'
outputs:
IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
runs-on: ubuntu-latest
steps:
- uses: MetaMask/action-is-release@v2
id: is-release
```
### With specific commit message prefix
Here is an example of how to use the `commit-starts-with` option.
```yaml
jobs:
is-release:
outputs:
IS_RELEASE: ${{ steps.is-release.outputs.IS_RELEASE }}
runs-on: ubuntu-latest
steps:
- uses: MetaMask/action-is-release@v2
id: is-release
with:
commit-starts-with: 'Release [version]'
```
This will set `IS_RELEASE` to `true` if triggered on a commit where the package version changed, and where the commit message starts with "Release [new package version]" (e.g "Release 1.0.0", if the package version was updated to "1.0.0").
This field can support multiple patterns separated by a comma. For example, if `commit-starts-with` is set to `Release [version],Release/[version]`, it will match on both "Release 1.0.0" and "Release/1.0.0".
### Conditionally running release jobs
You can then add filters in following jobs so those will skip if the `IS_RELEASE` criteria isn't met:
```yaml
jobs:
is-release:
< insert example from above >
publish-release:
if: needs.is-release.outputs.IS_RELEASE == 'true'
runs-on: ubuntu-latest
needs: is-release
```