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, README: add settings for custom/extra indexes #16

Merged
merged 1 commit into from
Jun 27, 2022
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
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,43 @@ Example:
summary: false
```

### `index-url`

**Default**: Empty, indicating [PyPI](https://pypi.org)

The `index-url` setting specifies a base URL for an alternative PEP 503-compatible
package index.

**This is probably not want you want.** If your goal is to add *complementary*
indices to search (such as a corporate index with private packages), see
[`extra-index-urls`](#extra-index-urls).

Example:

```yaml
- uses: trailofbits/[email protected]
with:
index-url: https://example.corporate.local/simple
```

### `extra-index-urls`

**Default**: Empty (no extra indexes are searched by default)

The `extra-index-urls` specifies one or more *extra* PEP 503-compatible packages
indexes to search when resolving dependencies. Each URL is whitespace-separated.


Example:

```yaml
- uses: trailofbits/[email protected]
with:
extra-index-urls: |
https://example.corporate.local/simple
https://prod.corporate.local/simple
```

### Internal options
<details>
<summary>⚠️ Internal options ⚠️</summary>
Expand Down
9 changes: 9 additions & 0 deletions action.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@ def _fatal_help(msg):
if os.getenv("GHA_PIP_AUDIT_LOCAL", "false") != "false":
pip_audit_args.append("--local")

index_url = os.getenv("GHA_PIP_AUDIT_INDEX_URL")
if index_url != "":
pip_audit_args.extend(["--index-url", index_url])


extra_index_urls = os.getenv("GHA_PIP_AUDIT_EXTRA_INDEX_URLS", "").split()
if len(extra_index_urls) > 0:
for url in extra_index_urls:
pip_audit_args.extend(["--extra-index-url", url])

pip_audit_args.extend(
[
Expand Down
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ inputs:
description: "for environmental audits, consider only packages marked local (default false)"
required: false
default: false
index-url:
description: "the base URL for the PEP 503-compatible package index to use"
required: false
default: ""
extra-index-urls:
description: "extra PEP 503-compatible indexes to use, space separated"
required: false
default: ""
internal-be-careful-allow-failure:
description: "don't fail the job if the audit fails (default false)"
required: false
Expand Down Expand Up @@ -67,6 +75,8 @@ runs:
GHA_PIP_AUDIT_VULNERABILITY_SERVICE: "${{ inputs.vulnerability-service }}"
GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT: "${{ inputs.virtual-environment }}"
GHA_PIP_AUDIT_LOCAL: "${{ inputs.local }}"
GHA_PIP_AUDIT_INDEX_URL: "${{ inputs.index-url }}"
GHA_PIP_AUDIT_EXTRA_INDEX_URLS: "${{ inputs.extra-index-urls }}"
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 }}"
shell: bash