From d5697c6563d51b0247005e9ef64e97277de3a8f5 Mon Sep 17 00:00:00 2001 From: Edward McFarlane <3036610+emcfarlane@users.noreply.github.com> Date: Tue, 5 Nov 2024 13:17:04 -0500 Subject: [PATCH] Set debug when the action is using debug logging (#78) Inherits the debug condition from the action to enable running of commands with `--debug` flag set. This is preferred over an explicit `debug` parameter to avoid churn in changing the config. Closes #77 --- README.md | 6 ++++++ dist/index.js | 3 +++ src/main.ts | 3 +++ 3 files changed, 12 insertions(+) diff --git a/README.md b/README.md index fb3c7ec..d4e1192 100644 --- a/README.md +++ b/README.md @@ -283,6 +283,12 @@ we recommend migrating to this consolidated action that has additional capabilit See the [migration guide](MIGRATION.md) for more information. +## Debugging + +To debug the action, rerun the workflow with debug logging enabled. +This will run all buf commands with the `--debug` flag. +See the [re-run jobs with debug logging](https://github.blog/changelog/2022-05-24-github-actions-re-run-jobs-with-debug-logging/) for more information. + ## Feedback and support If you have any feedback or need support, please reach out to us on the [Buf Slack][slack], diff --git a/dist/index.js b/dist/index.js index 980290f..2f48abb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -46049,6 +46049,9 @@ var Status; })(Status || (Status = {})); // run executes the buf command with the given arguments. async function run(bufPath, args) { + if (core.isDebug()) { + args = ["--debug", ...args]; + } return exec.getExecOutput(bufPath, args, { ignoreReturnCode: true, env: { diff --git a/src/main.ts b/src/main.ts index 43ad520..bcd93c3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -405,6 +405,9 @@ interface Result extends exec.ExecOutput { // run executes the buf command with the given arguments. async function run(bufPath: string, args: string[]): Promise { + if (core.isDebug()) { + args = ["--debug", ...args]; + } return exec .getExecOutput(bufPath, args, { ignoreReturnCode: true,