@actions/exec Logger Behavior

I’ve been trying to create a custom GitHub action to enable management of one of the Open source project we manage. And while doing so, I ran into an odd issue where the @actions/exec logs are not behaving the way I was hoping it would.

It might be a silly one but here is the snippet I have.

function defaultStdOutCallback(): (data: Buffer) => void {
    return (data: Buffer) => {
        core.info(data.toString().trim())
    }
}

function defaultStdErrCallback(): (data: Buffer) => void {
    return (data: Buffer) => {
        core.error(data.toString().trim())
    }
}

function createExecOpts(
    bufferMode: boolean,
    silent: boolean,
    env: Map<string, string>,
    stdoutCallback: ((data: Buffer) => void) | null,
    stderrCallback: ((data: Buffer) => void) | null,
    stdLineCallback: ((data: string) => void) | null,
    errLineCallback: ((data: string) => void) | null
): ExecOptions {
    const opts: ExecOptions = {
        silent: true
    }
    if (bufferMode) {
        opts.listeners = {
            stdout: stdoutCallback || defaultStdOutCallback,
            stderr: stderrCallback || defaultStdErrCallback,
            debug: defaultStdOutLineCallback
        }
    } else {
        opts.listeners = {
            stdline: stdLineCallback || defaultStdOutLineCallback,
            errline: errLineCallback || defaultStdErrLineCallback,
            debug: defaultStdOutLineCallback
        }
    }
    if (env !== undefined && env.size > 0) {
        // eslint-disable-next-line github/array-foreach
        env.forEach((value, key) => {
            process.env[key] = value
        })
        opts.env = {
            ...process.env
        }
    }
    return opts
}

export async function commandRunnerWithEnv(
    cmd: string,
    args: string[],
    silent: boolean,
    env: Map<string, string>,
    stdoutCallback: ((data: Buffer) => void) | null,
    stderrCallback: ((data: Buffer) => void) | null
): Promise<number> {
    const opts = createExecOpts(true, silent, env, stdoutCallback, stderrCallback, null, null)
    return await exec.exec(cmd, args, opts)
}

I am not able to see any logs from the command I am running using this wrapper show up on my action workflow log screen.

Here is the repo for the action I am writing. The idea there is to provide a single action framework to manage all the projects in that org in a uniform fashion with as little configuration as possible. It extends off of some of the incredible work done by the community already.

I know the commands are executing as I can use the core.setOutput and I can see the values there getting set. However, I am not able to see the console showing any logs. Where did I go wrong ?

Any pointer on what I might be doing wrong would be greatly appreciated.

Regards, H