An open API service indexing awesome lists of open source software.

https://github.com/iawia002/get-tag-or-commit-id

GitHub Action to get the tag name if it exists otherwise returns the commit id
https://github.com/iawia002/get-tag-or-commit-id

Last synced: 7 months ago
JSON representation

GitHub Action to get the tag name if it exists otherwise returns the commit id

Awesome Lists containing this project

README

          

# Get tag or commit id

[![CI](https://github.com/iawia002/get-tag-or-commit-id/actions/workflows/ci.yml/badge.svg)](https://github.com/iawia002/get-tag-or-commit-id/actions/workflows/ci.yml)

`get-tag-or-commit-id` is a GitHub Action that gets the tag name if it exists otherwise returns the commit id.

## Usage

```yaml
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4

- name: Get tag or commit id
id: get-version-id
uses: iawia002/get-tag-or-commit-id@v1
with:
length: 7

- name: Print Output
id: output
run: echo "${{ steps.get-version-id.outputs.id }}"
```

## Inputs

| Name | Required | Default | Description |
| ------ | -------- | ------- | ------------------------------------ |
| length | `false` | 7 | the expected length of the commit id |

## Outputs

| Name | Description |
| ---- | --------------------------------- |
| id | the value of the tag or commit id |
| type | the type of value (tag/pr/commit) |