Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action: replace internal-be-careful-debug #36

Merged
merged 3 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 6 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**: `""`

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions action.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
5 changes: 0 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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