Skip to content

Commit

Permalink
Fixed new lines based on William Woodruff feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelMF committed Oct 27, 2023
1 parent 477e441 commit fd4ac54
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
17 changes: 9 additions & 8 deletions action.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
from base64 import b64encode
from pathlib import Path

sys.stdout.reconfigure(encoding="utf-8")

_HERE = Path(__file__).parent.resolve()
_TEMPLATES = _HERE / "templates"

_GITHUB_STEP_SUMMARY = Path(os.getenv("GITHUB_STEP_SUMMARY")).open("a")
_GITHUB_OUTPUT = Path(os.getenv("GITHUB_OUTPUT")).open("a")
_GITHUB_STEP_SUMMARY = Path(os.getenv("GITHUB_STEP_SUMMARY")).open(
"a", encoding="utf-8"
)
_GITHUB_OUTPUT = Path(os.getenv("GITHUB_OUTPUT")).open("a", encoding="utf-8")
_RENDER_SUMMARY = os.getenv("GHA_PIP_AUDIT_SUMMARY", "true") == "true"
_DEBUG = os.getenv("RUNNER_DEBUG") is not None

Expand Down Expand Up @@ -45,8 +49,7 @@ def _pip_audit(*args):


def _fatal_help(msg):
msg = f"::error::❌ {msg}"
print(sys.stdout.buffer.write(msg.encode("utf-8")))
print(f"::error::❌ {msg}")
sys.exit(1)


Expand Down Expand Up @@ -132,11 +135,9 @@ def _fatal_help(msg):
_debug(status.stdout)

if status.returncode == 0:
msg = "🎉 pip-audit exited successfully"
_summary(sys.stdout.buffer.write(msg.encode("utf-8")))
_summary("🎉 pip-audit exited successfully")
else:
msg = "❌ pip-audit found one or more problems"
_summary(sys.stdout.buffer.write(msg.encode("utf-8")))
_summary("❌ pip-audit found one or more problems")

output = "⚠️ pip-audit did not return any output"
try:
Expand Down
6 changes: 1 addition & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ runs:
# NOTE: Sourced, not executed as a script.
source "${{ github.action_path }}/setup/venv.bash"
if [[ "${{runner.os}}" == "Windows" ]]; then
python "${{ github.action_path }}/action.py" "${{ inputs.inputs }}"
else
${{ github.action_path }}/action.py "${{ inputs.inputs }}"
fi
python "${{ github.action_path }}/action.py" "${{ inputs.inputs }}"
env:
GHA_PIP_AUDIT_SUMMARY: "${{ inputs.summary }}"
GHA_PIP_AUDIT_NO_DEPS: "${{ inputs.no-deps }}"
Expand Down
2 changes: 1 addition & 1 deletion setup/venv.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fi
# `python -m pip install ...` invocation might happen to choose.
if [[ -n "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}" ]] ; then
if [[ -d "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}" ]]; then
if [[ "$OSTYPE" == "msys" || "$(uname)" == MSYS_NT* || "$(uname)" == MINGW* ]]; then
if [[ "$(uname)" == MSYS_NT* || "$(uname)" == MINGW* ]]; then
# execute in windows
source "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}/scripts/activate"
else
Expand Down

0 comments on commit fd4ac54

Please sign in to comment.