Skip to content

Commit

Permalink
Merge pull request #54 from srz-zumix/feature/subcommand_option
Browse files Browse the repository at this point in the history
Do not generate evnet json file if subcommand option is specified
  • Loading branch information
srz-zumix authored Aug 31, 2022
2 parents 0c22214 + c0d8ec0 commit bf70c2f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
FROM alpine:latest

COPY . /opt/gh-act
RUN apk add --no-cache -q -f github-cli && \
RUN apk add --no-cache -q -f bash curl github-cli && \
curl https://raw.githubusercontent.com/nektos/act/master/install.sh | bash && \
(cd /opt/gh-act && GH_TOKEN=x gh extension install .)

ENTRYPOINT [ "gh" ]
23 changes: 15 additions & 8 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=
WORKFLOWS_PATH=.github/workflows
CREATE_EVENT_JSON=${GHACT_CREATE_EVENT_JSON:-true}

while :; do
case "${1-}" in
Expand Down Expand Up @@ -66,6 +67,10 @@ parse_params() {
;;
--version )
echo "gh-act version ${GH_ACT_VERSION}"
CREATE_EVENT_JSON=false
;;
-g| --graph| -h| --help| -l| --list)
CREATE_EVENT_JSON=false
;;
-?*) ;;
?*)
Expand Down Expand Up @@ -1026,16 +1031,18 @@ if "${AUTO_GITHUB_TOKEN}"; then
fi
fi

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

if [ -z "${EVENT_PATH}" ]; then
EVENT_PATH="${TEMPFILE_DIR}/event.json"
ACT_OPTIONS+=(--eventpath "${EVENT_PATH}")
fi
if [ -z "${EVENT_PATH}" ]; then
EVENT_PATH="${TEMPFILE_DIR}/event.json"
ACT_OPTIONS+=(--eventpath "${EVENT_PATH}")
fi

create_event_json "${EVENT_PATH}"
create_event_json "${EVENT_PATH}"
fi
fi

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

0 comments on commit bf70c2f

Please sign in to comment.