Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github/commit/view action #197

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions github/commit/view/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "View GitHub commit"
description: "Get metadata about a GitHub commit"

inputs:
sha:
description: "The commit to audit"
required: true
release-search-limit:
description: "The number of releases to search through"
default: "15"

outputs:
tag:
description: "The associated release tag, if the release exists"
value: ${{ steps.commit.outputs.tag_name }}
release-id:
description: "The associated release id, if the release exists"
value: ${{ steps.commit.outputs.id }}
pre-release:
description: "If the associated release exists, is it a pre-release?"
value: ${{ steps.commit.outputs.prerelease }}
commitish:
description: "The associated commitish, if the release exists"
value: ${{ steps.commit.outputs.target_commitish }}

runs:
using: composite
steps:
- name: "[DEBUG] Inputs"
shell: bash
run: |
echo "==========INPUTS=========="
echo sha : ${{ inputs.sha }}

- name: "Check if a release exists for `${{ inputs.sha }}`"
id: commit
uses: cardinalby/[email protected]
with:
commitSha: ${{ inputs.sha }}
doNotFailIfNotFound: true # return blank outputs when not found instead of error
searchLimit: ${{ fromJSON(inputs.release-search-limit) }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Comment on lines +35 to +43
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrapping an external action with some inputs/outputs does not see valuable. It just buries what's happening.


- name: "[DEBUG] Outputs"
shell: bash
run: |
echo "==========OUTPUTS=========="
echo tag : ${{ steps.commit.outputs.tag_name }}
echo release-id : ${{ steps.commit.outputs.id }}
echo pre-release : ${{ steps.commit.outputs.prerelease }}
echo commitish : ${{ steps.commit.outputs.target_commitish }}