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

Support running inside windows self-hosted runner #43

Merged
merged 2 commits into from
Oct 30, 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
8 changes: 6 additions & 2 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
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ runs:
# NOTE: Sourced, not executed as a script.
source "${{ github.action_path }}/setup/venv.bash"

${{ github.action_path }}/action.py "${{ inputs.inputs }}"
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
7 changes: 6 additions & 1 deletion setup/venv.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ 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
source "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}/bin/activate"
if [[ "$(uname)" == MSYS_NT* || "$(uname)" == MINGW* ]]; then
# execute in windows
source "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}/scripts/activate"
else
source "${GHA_PIP_AUDIT_VIRTUAL_ENVIRONMENT}/bin/activate"
fi
else
die "Fatal: virtual environment is not a directory"
fi
Expand Down