File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -176,7 +176,20 @@ update_spm_dependency() {
176176 * )
177177 # For PR testing, point to the current commit.
178178 local current_revision
179- current_revision=$( git -C " $root_dir " rev-parse HEAD)
179+
180+ # Detect if we are in a PR or a regular push
181+ if [ " ${GITHUB_EVENT_NAME:- } " == " pull_request" ]; then
182+ if ! command -v jq & > /dev/null; then
183+ echo " Error: jq is required for PR testing." >&2
184+ exit 1
185+ fi
186+ # In a PR, read the real commit SHA from the event payload
187+ # This guarantees a hash that exists on the remote server
188+ current_revision=$( jq -r .pull_request.head.sha " ${GITHUB_EVENT_PATH} " )
189+ else
190+ # In a Push (or local run), HEAD is safe to use
191+ current_revision=$( git -C " $root_dir " rev-parse HEAD)
192+ fi
180193 echo " Setting SPM dependency to current revision: ${current_revision} "
181194 " $scripts_dir /update_firebase_spm_dependency.sh" \
182195 " $absolute_project_file " --revision " $current_revision "
You can’t perform that action at this time.
0 commit comments