1
0
mirror of https://github.com/benjlevesque/short-sha.git synced 2026-07-04 15:49:22 +02:00

Enable customization of env variable name

This commit is contained in:
Benjamin Levesque
2023-03-19 11:36:59 +01:00
parent 07f50eae02
commit 36eb8c5309
5 changed files with 33 additions and 9 deletions
+9 -6
View File
@@ -4,6 +4,8 @@
## 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]
@@ -13,20 +15,21 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: benjlevesque/short-sha@v2.1
- uses: benjlevesque/short-sha@v2.2
id: short-sha
with:
length: 6
- run: echo $SHA
env:
env:
SHA: ${{ steps.short-sha.outputs.sha }}
- run: echo $SHA
env:
env:
SHA: ${{ env.SHA }}
```
## Options
| Name | Required | Default | Description |
| ------ | -------- | ------- | ---------------------------------------- |
| length | `false` | 7 | the expected length of the shortened SHA |
| 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 |