You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo "::warning::No PR number on this event, so the labels could not be re-read. Enforcing the changeset check."
111
+
echo 'skip=false' >> "$GITHUB_OUTPUT"
112
+
exit 0
113
+
fi
114
+
# The pulls endpoint carries the PR's full label set inline, and a GET
115
+
# on it is covered by this job's own pull-requests permission -- no
116
+
# pagination, no wider scope than the job already declares.
117
+
if ! LABELS=$(gh api "repos/$GITHUB_REPOSITORY/pulls/$PR_NUMBER" --jq '.labels[].name'); then
118
+
echo "::warning::Could not read the labels of PR #$PR_NUMBER, so this run cannot see a 'skip-changeset' applied after the event fired. Enforcing the changeset check."
119
+
echo 'skip=false' >> "$GITHUB_OUTPUT"
120
+
exit 0
121
+
fi
122
+
echo "Labels on PR #$PR_NUMBER right now: ${LABELS:-(none)}"
123
+
# Whole-line fixed match, fed by a here-string rather than a pipe.
124
+
# `-x -F` because the payload expression this replaces, `contains(<array>,
125
+
# 'skip-changeset')`, matches an array ELEMENT exactly -- a substring
126
+
# match would newly exempt a PR labelled e.g. `skip-changeset-audit`.
127
+
# The here-string (as in release.yml) keeps `grep -q` out of a pipeline:
128
+
# -q closes the pipe on the first hit, so a piped writer can take
129
+
# SIGPIPE and, under `set -o pipefail`, flip this test to false for a
130
+
# long enough label list.
131
+
if grep -qxF 'skip-changeset' <<<"$LABELS"; then
132
+
echo "::notice::'skip-changeset' is on PR #$PR_NUMBER (read live, not from the event payload), so this PR declares no release of its own and the changeset check is exempt."
133
+
echo 'skip=true' >> "$GITHUB_OUTPUT"
134
+
else
135
+
echo 'skip=false' >> "$GITHUB_OUTPUT"
136
+
fi
137
+
138
+
# Every step from here down carries the same guard rather than the job
139
+
# carrying one `if:`, because a job-level `if:` cannot read a step of its
140
+
# own job. Repeating it beats the alternatives: a separate gate job would
141
+
# add a check row and a brand-new way to go red to a repo already fighting
142
+
# check-list noise, and testing the label inside the counting step would
143
+
# pay for checkout + install before discovering the PR is exempt.
0 commit comments