Skip to content

Commit 1c938b0

Browse files
authored
Merge pull request #68 from srz-zumix/feature/artifact_server_path
support --artifact-server-path
2 parents 0bd021d + dc1ce48 commit 1c938b0

File tree

2 files changed

+20
-30
lines changed

2 files changed

+20
-30
lines changed

.circleci/config.yml

-26
This file was deleted.

gh-act

+20-4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ parse_params() {
2424
AUTO_GITHUB_TOKEN=${GHACT_AUTO_GITHUB_TOKEN:-true}
2525
ACT_JOB=
2626
ACT_DRYRUN=false
27+
ACT_ARTIFACT_SERVER_PATH=
2728
WORKFLOWS_PATH=.github/workflows
2829
CREATE_EVENT_JSON=${GHACT_CREATE_EVENT_JSON:-true}
2930

@@ -55,7 +56,9 @@ parse_params() {
5556
while :; do
5657
case "${1-}" in
5758
-a| --actor ) shift ;;
58-
--artifact-server-path ) shift ;;
59+
--artifact-server-path )
60+
ACT_ARTIFACT_SERVER_PATH="${2-}"
61+
shift ;;
5962
--artifact-server-port ) shift ;;
6063
--container-architecture ) shift ;;
6164
--container-cap-add ) shift ;;
@@ -1193,6 +1196,14 @@ function act_post_action() {
11931196
true
11941197
}
11951198

1199+
TEMPFILE_DIR=
1200+
function tempdir() {
1201+
if [ -z "${TEMPFILE_DIR}" ] || [ ! -d "${TEMPFILE_DIR}" ]; then
1202+
TEMPFILE_DIR=$(mktemp -d gh-act.XXXXXX)
1203+
trap 'rm -rf "${TEMPFILE_DIR}"' EXIT
1204+
fi
1205+
}
1206+
11961207
function main() {
11971208

11981209
# trap act_int_action INT
@@ -1219,9 +1230,7 @@ function main() {
12191230

12201231
if "${CREATE_EVENT_JSON}"; then
12211232
if [ ! -f "${EVENT_PATH}" ]; then
1222-
TEMPFILE_DIR=$(mktemp -d gh-act.XXXXXX)
1223-
trap 'rm -rf "${TEMPFILE_DIR}"' EXIT
1224-
1233+
tempdir
12251234
if [ -z "${EVENT_PATH}" ]; then
12261235
EVENT_PATH="${TEMPFILE_DIR}/event.json"
12271236
ACT_OPTIONS+=(--eventpath "${EVENT_PATH}")
@@ -1231,6 +1240,13 @@ function main() {
12311240
fi
12321241
fi
12331242

1243+
if [ -z "${ACT_ARTIFACT_SERVER_PATH}" ]; then
1244+
tempdir
1245+
TEMP_ARTIFACT_DIR="${TEMPFILE_DIR}/artifact"
1246+
mkdir -p "${TEMP_ARTIFACT_DIR}"
1247+
ACT_OPTIONS+=(--artifact-server-path "${TEMP_ARTIFACT_DIR}")
1248+
fi
1249+
12341250
act "$@" "${ACT_OPTIONS[@]}" && act_post_action
12351251
}
12361252

0 commit comments

Comments
 (0)