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 --artifact-server-path #68

Merged
merged 1 commit into from
Jan 9, 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
26 changes: 0 additions & 26 deletions .circleci/config.yml

This file was deleted.

24 changes: 20 additions & 4 deletions gh-act
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ parse_params() {
AUTO_GITHUB_TOKEN=${GHACT_AUTO_GITHUB_TOKEN:-true}
ACT_JOB=
ACT_DRYRUN=false
ACT_ARTIFACT_SERVER_PATH=
WORKFLOWS_PATH=.github/workflows
CREATE_EVENT_JSON=${GHACT_CREATE_EVENT_JSON:-true}

Expand Down Expand Up @@ -55,7 +56,9 @@ parse_params() {
while :; do
case "${1-}" in
-a| --actor ) shift ;;
--artifact-server-path ) shift ;;
--artifact-server-path )
ACT_ARTIFACT_SERVER_PATH="${2-}"
shift ;;
--artifact-server-port ) shift ;;
--container-architecture ) shift ;;
--container-cap-add ) shift ;;
Expand Down Expand Up @@ -1193,6 +1196,14 @@ function act_post_action() {
true
}

TEMPFILE_DIR=
function tempdir() {
if [ -z "${TEMPFILE_DIR}" ] || [ ! -d "${TEMPFILE_DIR}" ]; then
TEMPFILE_DIR=$(mktemp -d gh-act.XXXXXX)
trap 'rm -rf "${TEMPFILE_DIR}"' EXIT
fi
}

function main() {

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

if "${CREATE_EVENT_JSON}"; then
if [ ! -f "${EVENT_PATH}" ]; then
TEMPFILE_DIR=$(mktemp -d gh-act.XXXXXX)
trap 'rm -rf "${TEMPFILE_DIR}"' EXIT

tempdir
if [ -z "${EVENT_PATH}" ]; then
EVENT_PATH="${TEMPFILE_DIR}/event.json"
ACT_OPTIONS+=(--eventpath "${EVENT_PATH}")
Expand All @@ -1231,6 +1240,13 @@ function main() {
fi
fi

if [ -z "${ACT_ARTIFACT_SERVER_PATH}" ]; then
tempdir
TEMP_ARTIFACT_DIR="${TEMPFILE_DIR}/artifact"
mkdir -p "${TEMP_ARTIFACT_DIR}"
ACT_OPTIONS+=(--artifact-server-path "${TEMP_ARTIFACT_DIR}")
fi

act "$@" "${ACT_OPTIONS[@]}" && act_post_action
}

Expand Down