Skip to content

Commit

Permalink
Set debug when the action is using debug logging (#78)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
emcfarlane authored Nov 5, 2024
1 parent 7997a8a commit d5697c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
3 changes: 3 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Result> {
if (core.isDebug()) {
args = ["--debug", ...args];
}
return exec
.getExecOutput(bufPath, args, {
ignoreReturnCode: true,
Expand Down

0 comments on commit d5697c6

Please sign in to comment.