1
0
mirror of https://github.com/benjlevesque/short-sha.git synced 2026-03-08 05:14:53 +01:00
Files
short-sha/src/main.ts
Benjamin LEVESQUE 12c1ae7a90 export env variable
2020-03-09 23:57:43 +01:00

22 lines
532 B
TypeScript

import * as core from '@actions/core'
import {context} from '@actions/github'
import {shorten} from './shorten'
async function run(): Promise<void> {
try {
const sha = context.sha
core.debug(`Sha: ${sha}`)
const length = Number(core.getInput('length'))
core.debug(`Length: ${length}`)
const shortSha = shorten(sha, length)
core.debug(`Output: ${shortSha}`)
core.setOutput('sha', shortSha)
core.exportVariable('SHA', shortSha)
} catch (error) {
core.setFailed(error.message)
}
}
run()