Skip to content

Retry the label lookup and ask for a label only when it is missing - #6

Merged
vramperez merged 1 commit into
mainfrom
semver-label-api-errors
Nov 13, 2026
Merged

vramperez merged 1 commit into
mainfrom
semver-label-api-errors

Conversation

@vramperez

Copy link
Copy Markdown
Contributor

When the GitHub API answered the lookup of a pull request's labels with an error page, gh failed with invalid character '<' looking for beginning of value. The job failed and the workflow commented on the pull request asking for a label it already had, as in FIWARE/odrl-authorization#33.

  • scripts/semver-label.sh retries each GitHub API call (3 attempts, 5 seconds apart, RETRIES and RETRY_DELAY).
    • When the calls keep failing, it exits with 2 and says so.
    • Only a missing or ambiguous label exits with 1, and then it also writes label-missing=true.
  • semver-version.yml and chart-pr.yml comment asking for the label only when label-missing is set.
  • chart-pr.yml reads the label with the same script instead of its own copy of the check, so it gets the retries too. Its label job checks out the script, hence contents: read.

Tests

  • bats tests: a failed call is retried; an API that keeps failing exits with 2 without label-missing; a missing label writes label-missing=true; a push's merged pull request is read with retries too
  • shellcheck, actionlint
  • This pull request is opened without a label first, so that its own chart-pr.yml run shows the comment, and labelled afterwards

When the GitHub API answered the lookup of the pull request's labels with an
error page, gh failed with "invalid character '<' looking for beginning of
value", the job failed, and the workflow commented on the pull request asking
for a label it already had.

semver-label.sh now retries each API call (3 attempts, 5 seconds apart) and
exits with 2 when they keep failing. Only a missing or ambiguous label exits
with 1 and writes `label-missing=true`, and the comment asking for the label
runs only then. chart-pr.yml reads the label with the same script instead of its
own copy of the check, so it gets the retries as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vramperez
vramperez requested a review from Mortega5 November 13, 2026 08:00
@github-actions

Copy link
Copy Markdown

Please apply exactly one of the following labels to the PR: 'patch', 'minor', 'major'.

@vramperez
vramperez merged commit 5fad323 into main Nov 13, 2026
7 of 8 checks passed
@vramperez
vramperez deleted the semver-label-api-errors branch November 13, 2026 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants