question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Enable adding labels if User has triage role

See original GitHub issue

Describe the bug Given a user with Triage access, labels are not added when creating an issue.

To Reproduce

  1. Give a user Triage access to a repo
  2. Create a Ticket with one label

The label is not applied.

Expected behavior Given Triage allow applying labels, I expect my label to be applied.

https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization

It appears I can add the labels once the issue is created

Confirmed with 1.112

Typically, in this usecase, I sucvcessfully apply with labels with something like:

			GHIssue issue = building.create();

			labels.forEach(t -> {
				try {
					issue.addLabels(t);
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			});

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
blacellecommented, Jun 6, 2020

My previous procedure was like:

GHIssueBuilder labelling = issueBuilder.body(fullContent)
	.label(issueLabel)
GHIssue issue = building.create();

If Owner, the issue is open with proper labels: OK If triage, the issue is open without any labels: KO

I then turned into:

My new procedure is something like:

GHIssueBuilder labelling = issueBuilder.body(fullContent)
         // I keep label in the builder is it is the standard use of the library
	.label(issueLabel)
GHIssue issue = building.create();

// Add labels after issue creation, in case the user has Triage role
labels.forEach(t -> {
	try {
	     issue.addLabels(t);
        } catch (IOException e) {
	     throw new UncheckedIOException(e);
          }
});

I then have a clear workaround in my code around the library.

I suggest the library either:

  1. Check the userRole and add labels if the user have role Triage (I don’t know if this is feasible, low-cost)
  2. Add labels as an implicit call to GHIssue.addLabel() right after Issue creation, so that one would not have to do it by himself (this solution is weak as it would means applying labels twice, while in 99% cases, the second label application is useless).
0reactions
gsmetcommented, Jul 21, 2021

Yeah, the problem is here: https://docs.github.com/en/rest/reference/issues#create-an-issue .

The doc says:

Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise.

So it’s properly documented but this limitation should be lifted to allow users with the triage permission to do the same.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatic Triage and Labelling (#30748) · Issues - GitLab.org
Things like assigning a user when a label is added, blocking moving columns if an issue still has incomplete tasks, etc.
Read more >
Ability to add and remove labels in Post Function to Workflow ...
This would be useful for use - we would like to mark all new issues with a NEW label so we could periodically...
Read more >
Issue workflow · Contributing · Development · Help · GitLab
In order to help track the feature proposals, we have created a feature label. For the time being, users that are not members...
Read more >
Automatically triaging tickets based on intent and language ...
When intelligent triage is enabled, the smart assist panel will automatically be available for users in the Agent Workspace.
Read more >
GitHub Permissions and Access in ZenHub
GitHub Issues must be enabled for all repositories you wish to use ZenHub with. Check Settings > General > Features to determine if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found