Skip to content

Commit

Permalink
Ability to save data to file
Browse files Browse the repository at this point in the history
  • Loading branch information
akarabach authored Apr 23, 2024
1 parent b64e019 commit 905a16f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {camelCase} from 'camel-case'
import {constantCase} from 'constant-case'
import {pascalCase} from 'pascal-case'
import {snakeCase} from 'snake-case'
import * as fs from 'fs'

const convertTypes: Record<string, (s: string) => string> = {
lower: s => s.toLowerCase(),
Expand All @@ -29,6 +30,7 @@ export default async function run(): Promise<void> {
const excludeListStr: string = core.getInput('exclude')
const convert: string = core.getInput('convert')
const convertPrefixStr = core.getInput('convert_prefix')
const outputFileName = core.getInput('output_file_name')
const convertPrefix = convertPrefixStr.length
? convertPrefixStr === 'true'
: true
Expand Down Expand Up @@ -101,6 +103,10 @@ with:

core.exportVariable(newKey, secrets[key])
core.info(`Exported secret ${newKey}`)
if (outputFileName) {
fs.appendFileSync(outputFileName, `${newKey}=${secrets[key]}`);
core.info(`Exported secret ${newKey} to ${outputFileName}`)
}
}
} catch (error) {
if (error instanceof Error) core.setFailed(error.message)
Expand Down

0 comments on commit 905a16f

Please sign in to comment.