Skip to content

Commit

Permalink
fix output setup
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljguarino committed Aug 14, 2023
1 parent 7f2fea2 commit 03e67b2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ async function setupConfig(vsn) {
if (!conf) {
if (cmp(vsn, '0.7.0') >= 0) {
await setupTempConfig()
setOutput()
} else {
core.setFailed("you must use versions greater than 0.7.0 with temporary credentials")
}
Expand All @@ -60,6 +61,7 @@ async function setupConfig(vsn) {
await fs.writeFile(path.join(homedir, ".plural", "config.yml"), conf, 'utf8', (err) => {
if (err) throw err
core.info('wrote config file')
setOutput()
})
}

Expand All @@ -75,10 +77,10 @@ async function setupTempConfig() {
await exec.exec(`plural auth oidc github_actions --token ${token} --email ${email}`)
}

async function setOutput() {
function setOutput() {
const fname = path.join(process.env.HOME, '.plural', 'config.yml')
const config = yaml.load(fs.readFileSync(fname, 'utf8'));
core.setOutput('token', config.spec.token)
core.setOutput('token', config?.spec?.token || config?.token)
}

run();

0 comments on commit 03e67b2

Please sign in to comment.