ci: pass the branch name to jq as an argument in the iOS artifact lookup

The branch name was part of the jq program text, so a branch named to close the string could select an artifact from a fork or another branch. Same fix as the desktop lookup.
This commit is contained in:
spacedandy-agents-simplex
2026-10-16 21:00:40 +00:00
parent c67ea513f3
commit cbb2480b4e
+3 -3
View File
@@ -8,10 +8,10 @@
set -euo pipefail
name=$1
run_id=$(gh api "repos/$GITHUB_REPOSITORY/actions/artifacts?name=$name&per_page=100" --jq "
run_id=$(gh api "repos/$GITHUB_REPOSITORY/actions/artifacts?name=$name&per_page=100" | jq -r --arg branch "$GITHUB_REF_NAME" '
[.artifacts[]
| select((.expired | not) and .workflow_run.head_branch == \"$GITHUB_REF_NAME\" and .workflow_run.head_repository_id == .workflow_run.repository_id)]
| sort_by(.created_at) | last | .workflow_run.id // empty")
| select((.expired | not) and .workflow_run.head_branch == $branch and .workflow_run.head_repository_id == .workflow_run.repository_id)]
| sort_by(.created_at) | last | .workflow_run.id // empty')
if [ -n "$run_id" ]; then
echo "$name: from run $run_id"
echo "run-id=$run_id" >> "$GITHUB_OUTPUT"