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

Add support for PR labels #2523

Merged
merged 6 commits into from
Jun 15, 2022
Merged

Conversation

ybasket
Copy link
Contributor

@ybasket ybasket commented Feb 12, 2022

Takes a stab at #1471 to make the PR/MR labels appear not only in the textual description, but also using the git hoster's native labelling feature. Implemented for GitHub and GitLab, Bitbucket doesn't have a native label feature, only a plugin (for which support could be added later, now the implementation just logs a warning). It's opt-in for now as it's a change in behaviour not every user might appreciate, but could be promoted to a default later on.

Note: GitHub creates the labels with a standard grey colour (first screenshot), but the user can update that (see second).

PS: Scala Steward is not only a great help, but also a very nice codebase to work with, thank you!

Closes #1471

Screenshot 2022-02-12 at 11 50 44

Screenshot 2022-02-12 at 12 04 08

Screenshot 2022-02-12 at 12 25 18

Put the labels that are created in text also as GH labels onto the PR via the API.
Make labelling a general operation and implement it for GitLab as well.
@ybasket
Copy link
Contributor Author

ybasket commented Feb 13, 2022

Just fixed the broken test – sorry for not running the full test suite locally before, now I need another workflow approval 🙄

@codecov
Copy link

codecov bot commented Feb 13, 2022

Codecov Report

Merging #2523 (4c09bd2) into main (7a3c8f2) will decrease coverage by 0.01%.
The diff coverage is 79.31%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2523      +/-   ##
==========================================
- Coverage   81.02%   81.01%   -0.02%     
==========================================
  Files         143      144       +1     
  Lines        2519     2544      +25     
  Branches       51       48       -3     
==========================================
+ Hits         2041     2061      +20     
- Misses        478      483       +5     
Impacted Files Coverage Δ
...ala/org/scalasteward/core/application/Config.scala 100.00% <ø> (ø)
...ala/org/scalasteward/core/nurture/NurtureAlg.scala 0.00% <0.00%> (ø)
...in/scala/org/scalasteward/core/vcs/VCSApiAlg.scala 100.00% <ø> (ø)
...lasteward/core/vcs/bitbucket/BitbucketApiAlg.scala 94.73% <0.00%> (-2.57%) ⬇️
...re/vcs/bitbucketserver/BitbucketServerApiAlg.scala 47.36% <0.00%> (-1.29%) ⬇️
...scala/org/scalasteward/core/vcs/VCSSelection.scala 22.22% <66.66%> (+3.47%) ⬆️
.../scala/org/scalasteward/core/application/Cli.scala 100.00% <100.00%> (ø)
...calasteward/core/vcs/data/NewPullRequestData.scala 100.00% <100.00%> (ø)
...rg/scalasteward/core/vcs/github/GitHubApiAlg.scala 85.00% <100.00%> (+6.42%) ⬆️
...rg/scalasteward/core/vcs/github/GitHubLabels.scala 100.00% <100.00%> (ø)
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7a3c8f2...4c09bd2. Read the comment docs.

Copy link
Contributor

@exoego exoego left a comment

Choose a reason for hiding this comment

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

LGTM

@laughedelic
Copy link

Long awaited feature! Thanks for implementing it!

It would be great to be able to configure (in the repo config) a subset of labels that Scala Steward will create. Some of the labels in the description are currently redundant and not all of them might be relevant to the project's workflow, so creating all of them might be a bit too noisy.

@ybasket
Copy link
Contributor Author

ybasket commented Feb 16, 2022

Long awaited feature! Thanks for implementing it!

It would be great to be able to configure (in the repo config) a subset of labels that Scala Steward will create. Some of the labels in the description are currently redundant and not all of them might be relevant to the project's workflow, so creating all of them might be a bit too noisy.

Glad to hear it's of use to someone 🙂

I thought about the filtering too and imagined this PR's feature could be augmented by some regex or another, maybe more semantic mechanism to filter the labels (not only on the PR, also in the body). But I concluded it deserves a separate PR. Chances are there that I find the time to do it once this one is merged.

@ybasket
Copy link
Contributor Author

ybasket commented Mar 22, 2022

@fthomas Codacy is unhappy about something that only got reformatted and test coverage is on a level where I don't see ways to reasonably improve it further. From my side the PR is hence ready to merge, unless you see something to take care of still?

@TonioGela
Copy link
Contributor

Any updates?

@exoego
Copy link
Contributor

exoego commented Apr 15, 2022

@fthomas Do you have a time to test this with your test Steward instance ??

@andresld
Copy link

Hi! Is there any update about this?

@exoego exoego added the enhancement New feature or request label Jun 15, 2022
@exoego exoego merged commit c82c860 into scala-steward-org:main Jun 15, 2022
@exoego
Copy link
Contributor

exoego commented Jun 15, 2022

Thanks and sorry for keeping you waiting 🙇
I will make a new release soon.

@leobenkel
Copy link

is this usable through the .scala-steward.conf file ? or in the github action ?

@ybasket
Copy link
Contributor Author

ybasket commented Aug 8, 2022

is this usable through the .scala-steward.conf file ? or in the github action ?

Depending on how you run Scala Steward, either just add --add-labels to the command line actions or supply

with:
  other-args: '--add-labels'

to the GitHub action.

@andresld
Copy link

andresld commented Aug 8, 2022

I was not able to make it work with the github action. I think that it is expected to place the argument in the other-args input, but it looks like this one is not correctly recognized:

Unexpected input(s) 'other-args', valid inputs are ['repos-file', 'github-repository', 'github-token', 'author-email', 'author-name', 'scala-steward-version', 'coursier-cli-url', 'ignore-opts-files', 'branches', 'sign-commits', 'signing-key', 'timeout', 'cache-ttl', 'github-api-url', 'scalafix-migrations', 'artifact-migrations', 'github-app-id', 'github-app-key', 'repo-config']

@leobenkel
Copy link

I was not able to make it work with the github action. I think that it is expected to place the argument in the other-args input, but it looks like this one is not correctly recognized:

Unexpected input(s) 'other-args', valid inputs are ['repos-file', 'github-repository', 'github-token', 'author-email', 'author-name', 'scala-steward-version', 'coursier-cli-url', 'ignore-opts-files', 'branches', 'sign-commits', 'signing-key', 'timeout', 'cache-ttl', 'github-api-url', 'scalafix-migrations', 'artifact-migrations', 'github-app-id', 'github-app-key', 'repo-config']

yes ok , i have the same experience with other-args not being valid :/

@leobenkel
Copy link

@andresld I added scala-steward-org/scala-steward-action#386

@leobenkel
Copy link

@andresld it would be nice if it was in the .scala-steward.conf since there is already a commit.message , there could be a commit.labels

@leobenkel
Copy link

@ybasket and @andresld , it has been fixed , see: scala-steward-org/scala-steward-action#386 (comment)

tanishiking added a commit to tanishiking/metals that referenced this pull request Sep 2, 2022
first step for scalameta#4333

Thit commit let scala-steward PRs put
Github labels such as `semver-spec-patch`, which will be
useful for mergify.

see:
scala-steward-org/scala-steward#2523
scala-steward-org/scala-steward-action#387
tanishiking added a commit to scalameta/metals that referenced this pull request Sep 4, 2022
first step for #4333

Thit commit let scala-steward PRs put
Github labels such as `semver-spec-patch`, which will be
useful for mergify.

see:
scala-steward-org/scala-steward#2523
scala-steward-org/scala-steward-action#387
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add labels to GitHub PRs (not just in description)
6 participants