mirror of
https://github.com/benjlevesque/short-sha.git
synced 2025-12-07 10:17:51 +01:00
export env variable
This commit is contained in:
@@ -20,6 +20,9 @@ jobs:
|
|||||||
- run: echo $SHA
|
- run: echo $SHA
|
||||||
env:
|
env:
|
||||||
SHA: ${{ steps.short-sha.outputs.sha }}
|
SHA: ${{ steps.short-sha.outputs.sha }}
|
||||||
|
- run: echo $SHA
|
||||||
|
env:
|
||||||
|
SHA: ${{ env.SHA }}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ test('test runs', () => {
|
|||||||
}
|
}
|
||||||
const output = cp.execSync(`node ${ip}`, options).toString()
|
const output = cp.execSync(`node ${ip}`, options).toString()
|
||||||
expect(output).toContain('::set-output name=sha::6e8dcc')
|
expect(output).toContain('::set-output name=sha::6e8dcc')
|
||||||
|
expect(output).toContain('::set-env name=SHA::6e8dcc')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
name: 'short-sha'
|
name: 'short-sha'
|
||||||
description: 'Provide a description here'
|
description: 'Provide a description here'
|
||||||
author: 'benjlevesque'
|
author: 'benjlevesque'
|
||||||
|
branding:
|
||||||
|
color: orange
|
||||||
|
icon: git-pull-request
|
||||||
inputs:
|
inputs:
|
||||||
length:
|
length:
|
||||||
description: 'length of the sha1'
|
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);
|
const shortSha = shorten_1.shorten(sha, length);
|
||||||
core.debug(`Output: ${shortSha}`);
|
core.debug(`Output: ${shortSha}`);
|
||||||
core.setOutput('sha', shortSha);
|
core.setOutput('sha', shortSha);
|
||||||
|
core.exportVariable('SHA', shortSha);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ async function run(): Promise<void> {
|
|||||||
core.debug(`Output: ${shortSha}`)
|
core.debug(`Output: ${shortSha}`)
|
||||||
|
|
||||||
core.setOutput('sha', shortSha)
|
core.setOutput('sha', shortSha)
|
||||||
|
core.exportVariable('SHA', shortSha)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user