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:
@@ -20,6 +20,9 @@ jobs:
|
||||
- run: echo $SHA
|
||||
env:
|
||||
SHA: ${{ steps.short-sha.outputs.sha }}
|
||||
- run: echo $SHA
|
||||
env:
|
||||
SHA: ${{ env.SHA }}
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
@@ -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')
|
||||
})
|
||||
|
||||
@@ -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
1
dist/index.js
vendored
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user