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

@mention in PR body is not autolinked #1033

Closed
ericis opened this issue Jan 11, 2022 · 8 comments
Closed

@mention in PR body is not autolinked #1033

ericis opened this issue Jan 11, 2022 · 8 comments

Comments

@ericis
Copy link

ericis commented Jan 11, 2022

Subject of the issue

Mentioning a team or user does not seem to properly autolink.

Steps to reproduce

See: ourchitecture/hello-cloud#192 (comment)

The team @ourchitecture/hello-cloud-maintainers is not auto-linked in the PR, despite the team having maintainer access to the repo.

The GitHub Actions source code for this is located here:
https://github.com/ourchitecture/hello-cloud/blob/d7ff33a325d53a6852d93a4ebf7c3416280ecf20/.github/workflows/documentation.yml#L8

And, here:
https://github.com/ourchitecture/hello-cloud/blob/d7ff33a325d53a6852d93a4ebf7c3416280ecf20/.github/workflows/documentation.yml#L69

@peter-evans
Copy link
Owner

Hi @ericis

I don't think this has anything to do with the action itself. Check the visibility of the team. Is it secret or visible?

You mentioned @ourchitecture/hello-cloud-maintainers in your issue above. Is it linked properly for you? It's not linked for me because I'm not a member of the org.

image

@ericis
Copy link
Author

ericis commented Jan 12, 2022

@ericis
Copy link
Author

ericis commented Jan 12, 2022

@peter-evans here is an example of direct mentions working:
ourchitecture/hello-cloud#191 (comment)

I can edit the original PR message and "fix" the mention by retyping it. At one point, an extra space at the end triggered the browser, so I added an extra space before and after the mention too (2 spaces before and after).

By the way, I tried a few variations without success:

  • with @ and without
  • with org prefix ("ourchitecture/") and without
  • tried #{...} just to see

@peter-evans
Copy link
Owner

The example you just linked shows this for me:
image

I don't have access to the team which is why the hovercard doesn't show, but the link is there.

I think the user who makes the comment matters. Your user account is in the org so when you mention the team it links correctly. The automated PR is being created by the github-actions bot user. This is a special account which is linked to the default GITHUB_TOKEN. I think what might work is to create the PR using a PAT created on an account that is a member of the org.

@ericis
Copy link
Author

ericis commented Jan 12, 2022

Makes sense. I'll try with a PAT from the github "system account" (just another account) and will provide an update.

Ultimately, mentioning the team was just an attempt to work-around the issue that I couldn't assign the team to "reviewers" and fell back on assigning the system account with hopes that I could @mention the team.

@peter-evans
Copy link
Owner

For assigning a team as reviewers check this issue which explains the solution: #155 (comment)

@ericis
Copy link
Author

ericis commented Jan 12, 2022

@peter-evans we think alike! I already linked that exact comment in the build's "reviewers" section below. Thank you.

https://github.com/ourchitecture/hello-cloud/blob/c747894eb3d3345e99dccea22e749167069965de/.github/workflows/documentation.yml#L10-L12

  # this variable uses a system account since there are permission issues when assigning teams
  # see: https://github.com/peter-evans/create-pull-request/issues/155#issuecomment-611904487
  OUR_AUTODOC_REVIEWERS: "ourchitectureio"

@ericis
Copy link
Author

ericis commented Jan 13, 2022

@peter-evans Thank you. Success! ourchitecture/hello-cloud#196

Both the body @mention and the "team-reviewers" field are working properly once I setup a PAT.

Our setup:

  • Team named "@ourchitecture/hello-cloud-maintainers" that is granted "Maintainer" access to the repository
  • "System" account (just another GitHub account) is assigned to the team and inherits "Maintainer" access to the repository
  • Personal Access Token (PAT) generated by the "system" account and saved as a named "Action secret" in the repository
  • GitHub Actions updated to use the PAT secret when creating the PR using "team-reviewers" to assign the team as well as mentioning the team in the body of the PR "@ourchitecture/hello-cloud-maintainers"

image

@ericis ericis closed this as completed Jan 13, 2022
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

No branches or pull requests

2 participants