Skip to content
Open
Changes from all 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
3 changes: 2 additions & 1 deletion .github/workflows/e2e-label-help.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
esac

mirror_ref="pull-request/$PR_NUMBER"
mirror_sha=$(gh api "repos/$GH_REPO/branches/$mirror_ref" --jq '.commit.sha' 2>/dev/null || echo "")
mirror_sha=$(gh api "repos/$GH_REPO/git/ref/heads/$mirror_ref" --jq '.object.sha' 2>/dev/null || true)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why || true and not || echo ""?

@rhuss rhuss Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual change here is to move from .commit.sha to .object.sha on the refs endpoint to avoid issues with / in branch names.

The true is just more idiomatic, as the output is already empty on failure (so no need to iterate on this), and the important part here is to return with an no error code (which is only a side effect of echo, the true pronounces this better). This is mostly to make set -e happy.

It's also aligned with the validation guard on the next line.

But happy to revert that part if needed.

if [[ ! "$mirror_sha" =~ ^[0-9a-f]{40}$ ]]; then mirror_sha=""; fi
short_pr=${PR_HEAD_SHA:0:7}

if [ -z "$mirror_sha" ]; then
Expand Down
Loading