Skip to content

Commit a5fde8a

Browse files
authored
Remove hacky subprocess call in action.yml (#3226)
Updates action.yml to use the alternative $GITHUB_ACTION_PATH variable instead of the original ${{ github.action_path }} which caused issues with bash on the Windows runners. This removes the need for a Python subprocess to call the main.py script.
1 parent 21218b6 commit a5fde8a

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ Multiple contributions by:
7979
- [Hugo Barrera](mailto::[email protected])
8080
- Hugo van Kemenade
8181
- [Hynek Schlawack](mailto:[email protected])
82+
- [Ionite](mailto:[email protected])
8283
- [Ivan Katanić](mailto:[email protected])
8384
- [Jakub Kadlubiec](mailto:[email protected])
8485
- [Jakub Warczarek](mailto:[email protected])

action.yml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,10 @@ runs:
2929
using: composite
3030
steps:
3131
- run: |
32-
# Exists since using github.action_path + path to main script doesn't work because bash
33-
# interprets the backslashes in github.action_path (which are used when the runner OS
34-
# is Windows) destroying the path to the target file.
35-
#
36-
# Also semicolons are necessary because I can't get the newlines to work
37-
entrypoint="import sys;
38-
import subprocess;
39-
from pathlib import Path;
40-
41-
MAIN_SCRIPT = Path(r'${GITHUB_ACTION_PATH}') / 'action' / 'main.py';
42-
43-
proc = subprocess.run([sys.executable, str(MAIN_SCRIPT)]);
44-
sys.exit(proc.returncode)
45-
"
46-
4732
if [ "$RUNNER_OS" == "Windows" ]; then
48-
echo $entrypoint | python
33+
python $GITHUB_ACTION_PATH/action/main.py
4934
else
50-
echo $entrypoint | python3
35+
python3 $GITHUB_ACTION_PATH/action/main.py
5136
fi
5237
env:
5338
# TODO: Remove once https://github.com/actions/runner/issues/665 is fixed.

0 commit comments

Comments
 (0)