mirror of
https://github.com/actions-rust-lang/audit.git
synced 2025-12-27 01:43:48 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96e0e19d75 | ||
|
|
d57b2706e6 | ||
|
|
6028f82778 | ||
|
|
5bcf9487c7 | ||
|
|
165f86c1a6 |
@@ -31,7 +31,7 @@ repos:
|
||||
additional_dependencies:
|
||||
- types-requests
|
||||
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||
rev: 0.29.4
|
||||
rev: 0.30.0
|
||||
hooks:
|
||||
- id: check-dependabot
|
||||
- id: check-github-actions
|
||||
|
||||
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.2.3] - 2024-12-17
|
||||
|
||||
* Show a better error message when running "cargo audit" fails #98
|
||||
|
||||
## [1.2.2] - 2024-11-06
|
||||
|
||||
* Update `cargo-audit` to 0.21.0
|
||||
@@ -35,7 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [1.1.11] - 2024-01-18
|
||||
|
||||
* Allow specifying the path to the `Cargo.lock` file, in case it is not in the root of the repository (#55)
|
||||
* Update the example in the readme, to have the correct permissions for private repositories.
|
||||
* Update the example in the README, to have the correct permissions for private repositories.
|
||||
|
||||
## [1.1.10] - 2023-11-02
|
||||
|
||||
|
||||
35
audit.py
35
audit.py
@@ -7,18 +7,32 @@ from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
import requests
|
||||
|
||||
# GitHub API CLient copied and adapted from
|
||||
# GitHub API Client copied and adapted from
|
||||
# https://github.com/alstr/todo-to-issue-action/blob/25c80e9c4999d107bec208af49974d329da26370/main.py
|
||||
# Originally licensed under MIT license
|
||||
|
||||
# Timeout in seconds for requests methods
|
||||
TIMEOUT = 30
|
||||
"""Timeout in seconds for requests methods"""
|
||||
|
||||
NEWLINE = "\n"
|
||||
"""Definition of newline"""
|
||||
|
||||
|
||||
def debug(message: str) -> None:
|
||||
"""Print a debug message to the GitHub Action log"""
|
||||
newline = "\n"
|
||||
print(f"""::debug::{message.replace(newline, " ")}""")
|
||||
print(f"""::debug::{message.replace(NEWLINE, " ")}""")
|
||||
|
||||
|
||||
def error(message: str) -> None:
|
||||
"""Print an error message to the GitHub Action log"""
|
||||
print(f"""::error::{message.replace(NEWLINE, " ")}""")
|
||||
|
||||
|
||||
def group(title: str, message: str) -> None:
|
||||
"""Print an expandable group message to the GitHub Action log"""
|
||||
print(f"::group::{title}")
|
||||
print(message)
|
||||
print("::endgroup::")
|
||||
|
||||
|
||||
class Issue:
|
||||
@@ -420,7 +434,18 @@ def run() -> None:
|
||||
debug(f"Command return code: {completed.returncode}")
|
||||
debug(f"Command output: {completed.stdout}")
|
||||
debug(f"Command error: {completed.stderr}")
|
||||
data = json.loads(completed.stdout)
|
||||
try:
|
||||
data = json.loads(completed.stdout)
|
||||
except json.decoder.JSONDecodeError as _:
|
||||
error(
|
||||
f"cargo audit did not produce any JSON output. Exit code: {completed.returncode}"
|
||||
)
|
||||
group(
|
||||
"cargo audit output",
|
||||
f"""stdout:\n{completed.stdout}\n\n\nstderr:\n{completed.stderr}""",
|
||||
)
|
||||
|
||||
sys.exit(2)
|
||||
|
||||
summary = create_summary(data)
|
||||
entries = create_entries(data)
|
||||
|
||||
Reference in New Issue
Block a user