Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add a flag to disable adding labels to new pull requests #1399

Merged
merged 1 commit into from
Apr 18, 2022

Conversation

dazuma
Copy link
Member

@dazuma dazuma commented Apr 16, 2022

Introduces the flag --skip-labeling that skips the application of labels to newly created pull requests (even if the label option is set). We keep the label option set (e.g. to its default of ['autorelease: pending']) throughout the manifest logic so that it does not affect that logic or plugin logic, but then when it gets into the github.ts layer we use the new flag to disable the additional API call that sets the labels after the pull request is created.

This is needed for use cases that call the release-please CLI using a token (such as YOSHI_CODE_BOT_TOKEN) that does not have permissions on the repo. In such cases, the second call that sets labels on the newly created PR will fail from insufficient permissions, thus causing release-please to terminate with an error. Repos that run into this case (such as google-cloud-ruby) have other mechanisms to set the labels after release-please is finished. All we need is some way to prevent release-please from erroring out.

I originally tried to handle this use case by passing an empty array using the --label= flag. This, however, fails because this value is used for other purposes in addition to setting the labels for new release PRs. For example, it is used to identify existing untagged release PRs. Thus, we cannot empty the label option, and we must introduce some other means to tell release-please not to attempt to make the problematic PR edit call.

Tested end-to-end locally.

@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Apr 16, 2022
@dazuma dazuma force-pushed the pr/disable-labels branch 4 times, most recently from 01156dc to 7ef4773 Compare April 16, 2022 07:19
@dazuma dazuma marked this pull request as ready for review April 16, 2022 17:14
@dazuma dazuma requested a review from a team as a code owner April 16, 2022 17:14
@dazuma dazuma requested a review from a team April 16, 2022 17:14
Copy link
Contributor

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

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

Implementation looks good to me, but can we rename to skip-labeling/skipLabeling? We have a related option in the manifest for skip-github-release.

@dazuma dazuma force-pushed the pr/disable-labels branch from 7ef4773 to e0bca39 Compare April 18, 2022 17:00
@dazuma dazuma force-pushed the pr/disable-labels branch from e0bca39 to b281911 Compare April 18, 2022 17:08
@dazuma
Copy link
Member Author

dazuma commented Apr 18, 2022

Implementation looks good to me, but can we rename to skip-labeling/skipLabeling? We have a related option in the manifest for skip-github-release.

Done.

@chingor13 chingor13 added the automerge Merge the pull request once unit tests and other checks pass. label Apr 18, 2022
@gcf-merge-on-green gcf-merge-on-green bot merged commit 3957ef5 into googleapis:main Apr 18, 2022
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Apr 18, 2022
gcf-merge-on-green bot pushed a commit that referenced this pull request Apr 18, 2022
🤖 I have created a release *beep* *boop*
---


## [13.13.0](v13.12.0...v13.13.0) (2022-04-18)


### Features

* add a flag to disable adding labels to new pull requests ([#1399](#1399)) ([3957ef5](3957ef5))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
@dazuma dazuma deleted the pr/disable-labels branch April 18, 2022 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants