Skip to content

fix(pr): pr create adds the labels of the title - #2782

Merged
dan-petty merged 9 commits into
mainfrom
fix/2748-pr-create-labels
Oct 30, 2026
Merged

dan-petty merged 9 commits into
mainfrom
fix/2748-pr-create-labels

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

devops pr create now gives the new pull request the labels that its Conventional Commit title gives, with the rule of intake. fix(ai) gives type/bug and scope/ai. The labels file is read from the base branch of the repository, so --repo works.

A scope that .github/labels.yml does not declare gets no label and a warning on stderr. If a label cannot be added, the command names the pull request, the labels and the reason, tells how to add a label by hand, and exits 1. The pull request stays open and its Status is still set. A dry run lists the label requests and sends none.

The rule is one function, title_labels, which intake uses too. The stage and implement jobs are not part of this change. Issue #2777 covers them.

Closes #2748

@dan-petty dan-petty added the type/bug Type bug: the code does not do what it must label Oct 30, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Test results

  • Full devops ci on the pushed code: all checks pass. The test check took 199 s (3 m 19 s).
  • Fail-to-pass run (devops ci fail-to-pass --base origin/main): 20 tests failed on the base and pass on the branch (tests/test_pr_cmd.py, tests/test_pr_status.py, tests/test_pr_title_labels.py).

Review findings fixed

  • Major: the warning for an undeclared scope went to stdout. It now goes to stderr. The test asserts the text is in stderr and not in stdout. The spec says stderr.
  • Minor: a dry run did not list the label requests. It now lists the read of the labels file and one label request for each label of the title, with <number> as the placeholder. It sends no request. A test covers it and the spec has the new requirement.
  • Minor: no test for "Audit agreement". A test now runs audit_repository_labels on a pull request that the command labeled, and expects no finding.
  • Minor: after a label failure the message gave no repair path. It now ends with the devops gh api -X POST repos/<repo>/issues/<number>/labels -f labels[]=<label> command.

Declined or noted

  • The audit only checks that a type/ and a scope/ label are present. It does not compare them with the title. The proposal says the criterion is met by presence, and that a check against the title is out of scope.
  • The title of this pull request has the scope pr. .github/labels.yml does not declare scope/pr, so the new warning fired on this very pull request and it has no scope label. This is correct behavior.
  • The stage and implement jobs are covered by feat(roadmap): the stage and implement jobs label their pull request from its title #2777.

@dan-petty
dan-petty marked this pull request as ready for review October 30, 2026 14:33
@dan-petty
dan-petty merged commit 7183af3 into main Oct 30, 2026
19 checks passed
@dan-petty
dan-petty deleted the fix/2748-pr-create-labels branch October 30, 2026 15:20
dan-petty-release Bot added a commit that referenced this pull request Oct 30, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.22.4](v0.22.3...v0.22.4)
(2026-10-30)


### Bug Fixes

* **pr:** pr create adds the labels of the title
([#2782](#2782))
([7183af3](7183af3)),
closes [#2748](#2748)
* **roadmap:** refused shell programs name their replacement
([#2783](#2783))
([0458f8f](0458f8f)),
closes [#2773](#2773)
* **roadmap:** restore the own group text in an implement step
([#2780](#2780))
([163a840](163a840)),
closes [#2774](#2774)
* **security:** lock joserfc at 1.7.7
([#2787](#2787))
([0b9f9e5](0b9f9e5)),
closes [#2786](#2786)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(pr): devops pr create labels the pull request from its title

1 participant