A tiny GitHub action to fetch the latest GitHub Release for a given repository. Originally forked from https://github.com/gregziegan/fetch-latest-release on 2023/04/27.
Parameter | Description | Required | Default |
---|---|---|---|
github_token |
A Github token, usually ${{ github.token }} . |
N | ${{ github.token }} |
repo_path |
Provide a "owner/repo" string for fetching from a different repo. If not provided the repository the composite action is ran in will be used. | N | The current repo |
url
The HTTP URL for this releaseassets_url
: The REST API HTTP URL for this release's assetsupload_url
: The REST API HTTP URL for uploading to this releasehtml_url
: The REST API HTTP URL for this releaseid
: ''node_id
: The unique identifier for accessing this release in the GraphQL APItag_name
: The name of the release's Git tagtarget_commitish
: ''name
: The title of the releasebody
: The description of the releasedraft
: Whether or not the release is a draftprerelease
: Whether or not the release is a prereleaseauthor_id
: ''author_node_id
: The unique identifier for accessing this release's author in the GraphQL APIauthor_url
: The REST API HTTP URL for this release's authorauthor_login
: The username used to login.author_html_url
: The HTTP URL for this release's authorauthor_type
: ''author_site_admin
: Whether or not this user is a site administrator
Example 1: Fetch the latest release from the repository this composite action was ran from.
steps:
- id: fetch-latest-github-release
uses: cityoflosangeles/fetch-latest-github-release@{latest-release} # ex. v1, v2, v3 etc. See https://github.com/CityOfLosAngeles/fetch-latest-github-release/releases
Example 2: Fetch the latest release from another repository. Make sure the generated token passed in has the appropriate permissions.
steps:
- id: fetch-latest-github-release
uses: cityoflosangeles/fetch-latest-github-release@{latest-release} # ex. v1, v2, v3 etc. See https://github.com/CityOfLosAngeles/fetch-latest-github-release/releases
with:
github_token: ${{ github.token }}
repo_path: "user/repo-name"
You will retrieve the output from subsequent GitHub Actions steps like:
- name: "Obtain Latest Tag Name & Run a Cool Process Against It"
uses: "hiimbex/some-cool-action@v1"
with:
version: ${{ steps.fetch-latest-github-release.outputs.tag_name }}
steps.fetch-latest-github-release.outputs.tag_name
is important, you can fetch other outputs
that are defined in action.yml
.
To run the tests locally, run npm test
.