Skip to content

Commit

Permalink
action: replace internal-be-careful-debug (#36)
Browse files Browse the repository at this point in the history
* action: replace `internal-be-careful-debug`

Signed-off-by: Andrew Pan <a@tny.town>

* action: use `RUNNER_DEBUG` env var

Signed-off-by: Andrew Pan <a@tny.town>

* action: yakshave

Signed-off-by: Andrew Pan <a@tny.town>

---------

Signed-off-by: Andrew Pan <a@tny.town>
  • Loading branch information
tnytown authored Mar 23, 2023
1 parent 75edeac commit 1abec09
Showing 3 changed files with 8 additions and 26 deletions.
25 changes: 6 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -281,25 +281,6 @@ Example
internal-be-careful-allow-failure: true
```

#### `internal-be-careful-debug`

**Default**: `false`

The `internal-be-careful-debug` setting enables additional debug logs,
both within `pip-audit` itself and the action's harness code. You can
use it to debug troublesome configurations.

Be mindful that `pip-audit`'s own debug logs contain HTTP requests,
which may or may not be sensitive in your use case.

Example:

```yaml
- uses: pypa/gh-action-pip-audit@v1.0.6
with:
internal-be-careful-debug: true
```

#### `internal-be-careful-extra-flags`
**Default**: `""`

@@ -373,6 +354,12 @@ in the virtual environment should be included:
local: true
```

### There's an issue with the action and I want to enable debug logging!

The action prints debug information when the `ACTIONS_STEP_DEBUG` secret is set
to `true``. You should be able to enable this behavior by
[following these instructions](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs#re-running-all-the-jobs-in-a-workflow).

## Tips and Tricks

### Running against a pipenv project
4 changes: 2 additions & 2 deletions action.py
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
_GITHUB_STEP_SUMMARY = Path(os.getenv("GITHUB_STEP_SUMMARY")).open("a")
_GITHUB_OUTPUT = Path(os.getenv("GITHUB_OUTPUT")).open("a")
_RENDER_SUMMARY = os.getenv("GHA_PIP_AUDIT_SUMMARY", "true") == "true"
_DEBUG = str(os.getenv("GHA_PIP_AUDIT_INTERNAL_BE_CAREFUL_DEBUG", "false")) != "false"
_DEBUG = os.getenv("RUNNER_DEBUG") is not None


def _template(name):
@@ -33,7 +33,7 @@ def _summary(msg):

def _debug(msg):
if _DEBUG:
print(f"\033[93mDEBUG: {msg}\033[0m", file=sys.stderr)
print(f"::debug::{msg}")


def _log(msg):
5 changes: 0 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
@@ -46,10 +46,6 @@ inputs:
description: "don't fail the job if the audit fails (default false)"
required: false
default: false
internal-be-careful-debug:
description: "run with debug logs (default false)"
required: false
default: false
internal-be-careful-extra-flags:
description: "extra flags to be passed in to pip-audit"
required: false
@@ -87,6 +83,5 @@ runs:
GHA_PIP_AUDIT_EXTRA_INDEX_URLS: "${{ inputs.extra-index-urls }}"
GHA_PIP_AUDIT_IGNORE_VULNS: "${{ inputs.ignore-vulns }}"
GHA_PIP_AUDIT_INTERNAL_BE_CAREFUL_ALLOW_FAILURE: "${{ inputs.internal-be-careful-allow-failure }}"
GHA_PIP_AUDIT_INTERNAL_BE_CAREFUL_DEBUG: "${{ inputs.internal-be-careful-debug }}"
GHA_PIP_AUDIT_INTERNAL_BE_CAREFUL_EXTRA_FLAGS: "${{ inputs.internal-be-careful-extra-flags }}"
shell: bash

0 comments on commit 1abec09

Please sign in to comment.