1
0
mirror of https://github.com/benjlevesque/short-sha.git synced 2025-12-06 01:37:51 +01:00

export env variable

This commit is contained in:
Benjamin LEVESQUE
2020-03-09 23:51:15 +01:00
parent 7ca07b8f5c
commit 12c1ae7a90
5 changed files with 9 additions and 0 deletions

View File

@@ -20,6 +20,9 @@ jobs:
- run: echo $SHA
env:
SHA: ${{ steps.short-sha.outputs.sha }}
- run: echo $SHA
env:
SHA: ${{ env.SHA }}
```
## Options

View File

@@ -12,4 +12,5 @@ test('test runs', () => {
}
const output = cp.execSync(`node ${ip}`, options).toString()
expect(output).toContain('::set-output name=sha::6e8dcc')
expect(output).toContain('::set-env name=SHA::6e8dcc')
})

View File

@@ -1,6 +1,9 @@
name: 'short-sha'
description: 'Provide a description here'
author: 'benjlevesque'
branding:
color: orange
icon: git-pull-request
inputs:
length:
description: 'length of the sha1'

1
dist/index.js vendored
View File

@@ -2031,6 +2031,7 @@ function run() {
const shortSha = shorten_1.shorten(sha, length);
core.debug(`Output: ${shortSha}`);
core.setOutput('sha', shortSha);
core.exportVariable('SHA', shortSha);
}
catch (error) {
core.setFailed(error.message);

View File

@@ -12,6 +12,7 @@ async function run(): Promise<void> {
core.debug(`Output: ${shortSha}`)
core.setOutput('sha', shortSha)
core.exportVariable('SHA', shortSha)
} catch (error) {
core.setFailed(error.message)
}