@@ -73,22 +73,27 @@ jobs:
7373 id : resolve-pr
7474 env :
7575 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
76+ EVENT_NAME : ${{ github.event_name }}
77+ DISPATCH_PR_NUMBER : ${{ github.event.inputs.pr_number }}
78+ COMMENT_PR_NUMBER : ${{ github.event.issue.number }}
79+ PULL_REQUEST_NUMBER : ${{ github.event.pull_request.number }}
80+ REVIEW_APP_PREFIX : ${{ vars.REVIEW_APP_PREFIX }}
7681 shell : bash
7782 run : |
7883 set -euo pipefail
7984
80- case "${{ github.event_name } }" in
85+ case "${EVENT_NAME }" in
8186 workflow_dispatch)
82- pr_number="${{ github.event.inputs.pr_number } }"
87+ pr_number="${DISPATCH_PR_NUMBER }"
8388 ;;
8489 issue_comment)
85- pr_number="${{ github.event.issue.number } }"
90+ pr_number="${COMMENT_PR_NUMBER }"
8691 ;;
8792 pull_request)
88- pr_number="${{ github.event.pull_request.number } }"
93+ pr_number="${PULL_REQUEST_NUMBER }"
8994 ;;
9095 *)
91- echo "Unsupported event type: ${{ github.event_name } }" >&2
96+ echo "Unsupported event type: ${EVENT_NAME }" >&2
9297 exit 1
9398 ;;
9499 esac
@@ -104,7 +109,7 @@ jobs:
104109
105110 {
106111 echo "PR_NUMBER=$pr_number"
107- echo "APP_NAME=${{ vars. REVIEW_APP_PREFIX } }-$pr_number"
112+ echo "APP_NAME=${REVIEW_APP_PREFIX}-$pr_number"
108113 echo "PR_SHA=$pr_sha"
109114 } >> "$GITHUB_ENV"
110115 echo "same_repo=${same_repo}" >> "$GITHUB_OUTPUT"
@@ -114,16 +119,18 @@ jobs:
114119 id : source
115120 env :
116121 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
122+ EVENT_NAME : ${{ github.event_name }}
123+ SAME_REPO : ${{ steps.resolve-pr.outputs.same_repo }}
117124 shell : bash
118125 run : |
119126 set -euo pipefail
120127
121- if [[ "${{ steps.resolve-pr.outputs.same_repo } }" == "true" ]]; then
128+ if [[ "${SAME_REPO }" == "true" ]]; then
122129 echo "allowed=true" >> "$GITHUB_OUTPUT"
123130 exit 0
124131 fi
125132
126- if [[ "${{ github.event_name } }" == "pull_request" ]]; then
133+ if [[ "${EVENT_NAME }" == "pull_request" ]]; then
127134 echo "allowed=false" >> "$GITHUB_OUTPUT"
128135 {
129136 echo "Review app deploys are skipped for fork pull requests."
@@ -133,7 +140,7 @@ jobs:
133140 fi
134141
135142 message="Review app deploys from fork pull requests are not allowed because this workflow uses repository secrets."
136- if [[ "${{ github.event_name } }" == "issue_comment" ]]; then
143+ if [[ "${EVENT_NAME }" == "issue_comment" ]]; then
137144 if ! gh pr comment "${PR_NUMBER}" --body "${message}"; then
138145 echo "Failed to post fork rejection comment to PR #${PR_NUMBER}" >&2
139146 fi
0 commit comments