Skip to content

Commit

Permalink
export env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
benjlevesque committed Mar 9, 2020
1 parent 7ca07b8 commit 12c1ae7
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
- run: echo $SHA
env:
SHA: ${{ steps.short-sha.outputs.sha }}
- run: echo $SHA
env:
SHA: ${{ env.SHA }}
```
## Options
Expand Down
1 change: 1 addition & 0 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
})
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
1 change: 1 addition & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 12c1ae7

Please sign in to comment.