mirror of
https://github.com/actions-rust-lang/audit.git
synced 2025-12-27 01:43:48 -05:00
Add optional input for Cargo lockfile
This commit is contained in:
@@ -54,6 +54,7 @@ Setting `denyWarnings` to true will also enable these warnings, but each warning
|
||||
| -------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------ |
|
||||
| `TOKEN` | The GitHub access token to allow us to retrieve, create and update issues (automatically set). | `github.token` |
|
||||
| `denyWarnings` | Any warnings generated will be treated as an error and fail the action. | false |
|
||||
| `file` | The path to the Cargo.lock file. | `Cargo.lock` |
|
||||
| `ignore` | A comma separated list of Rustsec IDs to ignore. | |
|
||||
| `createIssues` | Create/Update issues for each found vulnerability. By default only on `main` or `master` branch. | `github.ref == 'refs/heads/master' \|\| github.ref == 'refs/heads/main'` |
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ inputs:
|
||||
description: "Any warnings generated will be treated as an error and fail the action"
|
||||
required: false
|
||||
default: "false"
|
||||
file:
|
||||
description: "Cargo lockfile to inspect"
|
||||
required: false
|
||||
default: "Cargo.lock"
|
||||
ignore:
|
||||
description: "A comma separated list of Rustsec IDs to ignore"
|
||||
required: false
|
||||
@@ -52,6 +56,7 @@ runs:
|
||||
env:
|
||||
INPUT_CREATE_ISSUES: ${{ inputs.createIssues }}
|
||||
INPUT_DENY_WARNINGS: ${{ inputs.denyWarnings }}
|
||||
INPUT_FILE: ${{ inputs.file }}
|
||||
INPUT_IGNORE: ${{ inputs.ignore }}
|
||||
INPUT_TOKEN: ${{ inputs.TOKEN }}
|
||||
PYTHONPATH: ${{ github.action_path }}
|
||||
|
||||
4
audit.py
4
audit.py
@@ -398,6 +398,10 @@ def run() -> None:
|
||||
extra_args.append("--deny")
|
||||
extra_args.append("warnings")
|
||||
|
||||
if os.environ["INPUT_FILE"] != "":
|
||||
extra_args.append("--file")
|
||||
extra_args.append(os.environ["INPUT_FILE"])
|
||||
|
||||
audit_cmd = ["cargo", "audit", "--json"] + extra_args + ignore_args
|
||||
debug(f"Running command: {audit_cmd}")
|
||||
completed = subprocess.run(
|
||||
|
||||
Reference in New Issue
Block a user