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

Reduce api call #96

Merged
merged 7 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .github/workflows/deployment-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_dispatch:

jobs:
test:
deployment-test:
runs-on: ubuntu-latest
environment: gh-act-env
steps:
Expand Down
18 changes: 11 additions & 7 deletions gh-act
Original file line number Diff line number Diff line change
Expand Up @@ -425,12 +425,16 @@ function pull_request_event_envs() {
fi

pr_envs "${PULL_REQUEST_SPEC}"
# shellcheck disable=SC2086
HEAD=$(gh pr view ${PULL_REQUEST_SPEC} --json commits --jq .commits[].oid | tail -1)
# shellcheck disable=SC2086
HEAD_USER=$(gh pr view ${PULL_REQUEST_SPEC} --json commits --jq .commits[].authors[].login | tail -1)

# shellcheck disable=SC2086
BEFORE=$(gh pr view ${PULL_REQUEST_SPEC} --json commits --jq .commits[].oid | tail -2 | head -1)
# shellcheck disable=SC2086
read -r HEAD HEAD_USER <<< $(gh pr view ${PULL_REQUEST_SPEC} --json commits \
srz-zumix marked this conversation as resolved.
Show resolved Hide resolved
srz-zumix marked this conversation as resolved.
Show resolved Hide resolved
srz-zumix marked this conversation as resolved.
Show resolved Hide resolved
--template '{{- $last := 0}}
srz-zumix marked this conversation as resolved.
Show resolved Hide resolved
{{- range $index, $element := .commits}}{{$last = $index}}{{end}}
{{- $commit := index .commits $last}}
{{- $author := index $commit.authors 0}}
{{- $commit.oid }} {{ $author.login -}}')

# base
repo_envs "${OWNER}/${REPO}" "BASE"
Expand Down Expand Up @@ -1163,8 +1167,8 @@ function create_event_json() {
if [ -f "${SCRIPT_DIR}/templates/${EVENT_NAME}.json" ]; then

# common
OWNER=$(gh repo view --json owner --jq .owner.login)
REPO=$(gh repo view --json name --jq .name)
read -r OWNER REPO \
<<< $(gh repo view --json owner,name --template '{{ .owner.login }} {{ .name }}')
srz-zumix marked this conversation as resolved.
Show resolved Hide resolved

evnet_envs

Expand Down Expand Up @@ -1330,7 +1334,7 @@ function main() {
ACT_OPTIONS+=(--artifact-server-path "${TEMP_ARTIFACT_DIR}")
fi

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

case "${EVENT_NAME:-}" in
Expand Down