Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/benjlevesque/short-sha
Github Action to shorten the git SHA1 and make it accessible in outputs
https://github.com/benjlevesque/short-sha
devops
Last synced: 2 months ago
JSON representation
Github Action to shorten the git SHA1 and make it accessible in outputs
- Host: GitHub
- URL: https://github.com/benjlevesque/short-sha
- Owner: benjlevesque
- License: mit
- Created: 2020-03-09T18:02:57.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-02-05T09:52:40.000Z (11 months ago)
- Last Synced: 2024-10-24T15:44:18.428Z (3 months ago)
- Topics: devops
- Language: TypeScript
- Homepage:
- Size: 416 KB
- Stars: 51
- Watchers: 2
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Short SHA
`short-sha` is a GitHub Action than provides an output `sha` with the shortened commit SHA.
## Usage
You can access the shortened value with either `${{ steps.short-sha.outputs.sha }}` (`short-sha` being the name of the action step) or `${{ env.SHA }}`.
```yaml
name: 'build-test'
on: [push]jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 6
- run: echo $SHA
env:
SHA: ${{ steps.short-sha.outputs.sha }}
- run: echo $SHA
env:
SHA: ${{ env.SHA }}
```## Options
| Name | Required | Default | Description |
| ------------- | -------- | ------- | ---------------------------------------- |
| length | `false` | 7 | the expected length of the shortened SHA |
| variable_name | `false` | `SHA` | the name of the exported env variable |