git-get-release-action icon indicating copy to clipboard operation
git-get-release-action copied to clipboard

Github Action that allows you to get release information by release id, tag, commit SHA (current commit or specified).

integration-test functional-test build-pack

Get GitHub release information

Allows you to get a release information by release id, tag, commit SHA or get the last release.

If release not found, it finishes with an error.

Inputs

Search by:

Set exactly 1 input from the list to search release by:

🔸 releaseId

Release id (number).

🔸 tag

Tag name.

🔸 commitSha

SHA of commit. Can be used to find a draft release.

🔸 releaseName

Exact release name. Returns most recent found. Can be used to find a draft release.

🔸 releaseNameRegEx

Regexp to test release name

🔸 latest

Set 1 or true to get the latest non-draft release.

If no inputs specified, the action will try to get release for the current commit SHA.

Additional filters

With any of inputs above you can also use 2 additional filter inputs:

🔹 draft

Set true to search only for draft releases.
Set false to search only releases that are not draft. Leave empty to not check if a release is a draft.

🔹 prerelease

Set true to search only for prerelease releases.
Set false to search only releases that are not prerelease. Leave empty to not check if a release is a prerelease.

Options

🔻 doNotFailIfNotFound Optional, default: false

Set true to force the action to finish with success even if release was not found. Can be useful in composite actions, where continue-on-error is not available. If set, you can examine id output to know if release was found.

🔻 searchLimit Optional, default: 90

If you use one of commitSha, releaseName, releaseNameRegEx inputs you can also specify how many releases action should retrieve to perform a search. Specify more than 90 if you age going to search for old releases and less if you want to speed up the search.

🔻 repo Optional, default: current repository

Repository name in form of "owner/name". If not set, GITHUB_REPOSITORY env variable is used that by default points to a current repository.

Env variables

You should set GITHUB_TOKEN env variable to enable action to access GitHub API. For some operations default github.token is not enough, you need to pass a personal access token.

Outputs

Values from API response object:

  • html_url
  • upload_url can be used to upload assets
  • tarball_url
  • zipball_url
  • id
  • tag_name
  • target_commitish
  • name
  • body
  • draft contains true or false string value
  • prerelease contains true or false string value
  • created_at
  • published_at
  • url
  • assets_url
  • node_id
  • author (JSON with author object)
  • assets (JSON with assets object)

Usage example

- uses: cardinalby/git-get-release-action@v1
  env:
    GITHUB_TOKEN: ${{ github.token }}  # or your personal access token
  with:
    tag: '1.2.3'    
- uses: cardinalby/git-get-release-action@v1
  env:
    GITHUB_TOKEN: ${{ github.token }}  # or your personal access token
  with:
    commitSha: e92acb19de8845ad1f3cb6cfab421ac26002d6b6
    prerelease: false

For more examples check out functional self-test.