-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move get release tag into composite action (#79)
- Loading branch information
Showing
2 changed files
with
47 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Get release tag from GitHub API | ||
description: This workflow will get the requested release tag specified in the input, or the latest release tag via the Github API | ||
inputs: | ||
requested_release_tag: | ||
description: The release tag to search for | ||
required: false | ||
type: string | ||
outputs: | ||
release_tag: | ||
description: The release tag | ||
value: ${{ steps.get-release.outputs.result }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get latest or specified release | ||
uses: actions/github-script@v7 | ||
id: get-release | ||
with: | ||
retries: 3 | ||
result-encoding: string | ||
script: | | ||
let releaseObj; | ||
if (${{ inputs.requested_release_tag != '' }}) { | ||
releaseObj = await github.rest.repos.getReleaseByTag({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
tag: "${{ github.event.inputs.release_tag }}" | ||
}) | ||
} else { | ||
releaseObj = await github.rest.repos.getLatestRelease({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo | ||
}) | ||
} | ||
return releaseObj.data.tag_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters