From 4a2a74bc648417e5956feb17bedf44116f275ce1 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Fri, 1 Nov 2024 12:06:47 -0400 Subject: [PATCH 1/3] Set debug when the action is using debug logging Inherits the debug condition from the action to enable running of commands with `--debug` flag set. --- dist/index.js | 6 ++++++ src/main.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/dist/index.js b/dist/index.js index 980290f..dc768d8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -45881,6 +45881,9 @@ async function lint(bufPath, inputs) { return skip(); } const args = ["lint", "--error-format", "github-actions"]; + if (core.isDebug()) { + args.push("--debug"); + } if (inputs.input) { args.push(inputs.input); } @@ -46049,6 +46052,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..b7bd1b0 100644 --- a/src/main.ts +++ b/src/main.ts @@ -214,6 +214,9 @@ async function lint(bufPath: string, inputs: Inputs): Promise { return skip(); } const args = ["lint", "--error-format", "github-actions"]; + if (core.isDebug()) { + args.push("--debug"); + } if (inputs.input) { args.push(inputs.input); } @@ -405,6 +408,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, From 8dafc50d2ca2227e85c9ab137607d1cd4ebb2807 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Fri, 1 Nov 2024 12:08:29 -0400 Subject: [PATCH 2/3] Fix --- dist/index.js | 3 --- src/main.ts | 3 --- 2 files changed, 6 deletions(-) diff --git a/dist/index.js b/dist/index.js index dc768d8..2f48abb 100644 --- a/dist/index.js +++ b/dist/index.js @@ -45881,9 +45881,6 @@ async function lint(bufPath, inputs) { return skip(); } const args = ["lint", "--error-format", "github-actions"]; - if (core.isDebug()) { - args.push("--debug"); - } if (inputs.input) { args.push(inputs.input); } diff --git a/src/main.ts b/src/main.ts index b7bd1b0..bcd93c3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -214,9 +214,6 @@ async function lint(bufPath: string, inputs: Inputs): Promise { return skip(); } const args = ["lint", "--error-format", "github-actions"]; - if (core.isDebug()) { - args.push("--debug"); - } if (inputs.input) { args.push(inputs.input); } From 7a02279a717b3af409e7735642ea72fce43c5bc6 Mon Sep 17 00:00:00 2001 From: Edward McFarlane Date: Fri, 1 Nov 2024 12:22:08 -0400 Subject: [PATCH 3/3] Add debugging to README --- README.md | 6 ++++++ 1 file changed, 6 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],