mirror of
https://github.com/benjlevesque/short-sha.git
synced 2026-03-08 05:14:53 +01:00
22 lines
532 B
TypeScript
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()
|