Skip to content

fix(scripts): validate label option values - #83995

Open
RerankerGuo wants to merge 1 commit into
anthropics:mainfrom
RerankerGuo:fix/validate-label-option-values
Open

fix(scripts): validate label option values#83995
RerankerGuo wants to merge 1 commit into
anthropics:mainfrom
RerankerGuo:fix/validate-label-option-values

Conversation

@RerankerGuo

Copy link
Copy Markdown

Summary

Validate that --add-label and --remove-label each receive a label name before reading the next positional argument.

With set -u, invoking either option without a value previously aborted with an internal $2: unbound variable error. A following option could also be consumed as the missing value before failing later.

Changes

  • Report a specific error when --add-label has no value.
  • Report a specific error when --remove-label has no value.
  • Reject another option token where a label name is required.

Verification

  • --add-label without a value: exits 1 with a specific error and no unbound-variable message.
  • --remove-label without a value: exits 1 with a specific error and no unbound-variable message.
  • --add-label --remove-label bug: fails at --add-label instead of consuming the next option.
  • A normal add/remove invocation still filters valid labels and calls gh issue edit with both operations.
  • Ran bash -n scripts/edit-issue-labels.sh.
  • Ran git diff --check.

Scope

This PR only validates option values. It does not change label existence filtering or GitHub API behavior.

Report missing --add-label and --remove-label values explicitly instead of aborting through set -u with an unbound positional parameter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant