Skip to content

Commit

Permalink
add debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
aerickson14 committed Oct 16, 2024
1 parent f5bb0aa commit fc05240
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
7 changes: 6 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion src/1password.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ export class OnePassword {

async signOut(): Promise<void> {
const env = this.onePasswordEnv
await execWithOutput('op', ['signout', '--account', 'github_action', '--forget'], {env})
await execWithOutput(
'op',
['signout', '--account', 'github_action', '--forget'],
{env}
)
}
}
7 changes: 6 additions & 1 deletion src/exec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as exec from '@actions/exec'
import * as core from '@actions/core'

export async function execWithOutput(
command: string,
Expand All @@ -9,16 +10,20 @@ export async function execWithOutput(
let err = ''

const opt = options ?? {}
opt.silent = true // for debugging set this to false to see the output of 1password
opt.silent = false // for debugging set this to false to see the output of 1password
opt.listeners = {
stdout: (data: Buffer) => {
out += data.toString()
},
stderr: (data: Buffer) => {
err += data.toString().trim()
},
debug: (data: string) => {
core.info(`Debug: ${data}`)
}
}
try {
core.info(`Executing command: ${command} ${args ? args.join(' ') : ''}}`)
await exec.exec(command, args, opt)
} catch {
if (err) {
Expand Down

0 comments on commit fc05240

Please sign in to comment.