Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/danielroe/provenance-action. Fail CI when dependencies in your lockfile lose npm provenance or trus
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546import { writeFileSync } from 'node:fs'import process from 'node:process'
const INPUT_SEPARATORS_RE = /[ -]/g
export function getInput(name: string): string | undefined { const key = `INPUT_${name.replace(INPUT_SEPARATORS_RE, '_').toUpperCase()}` return process.env[key]}
export function setOutput(name: string, value: string): void { const filepath = process.env.GITHUB_OUTPUT if (!filepath) return writeFileSync(filepath, `${name}<<__EOF__\n${value}\n__EOF__\n`, { encoding: 'utf8', flag: 'a' })}
export function appendSummary(text: string): void { const filepath = process.env.GITHUB_STEP_SUMMARY if (!filepath) return writeFileSync(filepath, `${text}\n`, { encoding: 'utf8', flag: 'a' })}
export function log(message: any): void { // eslint-disable-next-line no-console console.log(String(message))}
export function logError(err: any): void { console.error(err instanceof Error ? err.stack || err.message : String(err))}
const PERCENT_RE = /%/gconst CR_RE = /\r/gconst LF_RE = /\n/g
export function annotate(level: 'error' | 'warning', file: string, line: number, col: number, message: string): void { const esc = (s: string) => String(s) .replace(PERCENT_RE, '%25') .replace(CR_RE, '%0D') .replace(LF_RE, '%0A') // eslint-disable-next-line no-console console.log(`::${level} file=${file},line=${line},col=${col}::${esc(message)}`)}