Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I have an ask by a team that maintains a dozen Github repos which is:
1. When a Pull Request is created
2. THEN add a component to the issue based on the name of the repo
For context, I have created components for each of their repos (e.g., 'react-hello-world' is a component in the project and the name of a repo)
Is it feasible to grab the name of the repo and then use that same smart value to edit the Component field?
Or do I have to use a multi if-else statement to apply the correct components?
Note: {{repoName}} = {{pullRequest.destinationBranch.repository.name}}
Hi @Connor Skiro - If the components match the name of the repo, the If/Else conditions will not be necessary. Are you encountering any issues with your rule?
I was able to get the if/else option to work, but I'm trying to avoid the if/else statements altogether.
Instead, I'm looking to add a component based on the GitHub repo name from the {{pullRequest}} smart value
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your rule looks good to me. Is the audit log showing any errors?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
An error on my part, {{pullRequest.destinationBranch.repository.name}} returns github-account/react-hello-world so I need to figure out if there's another smart value that just returns the repository name or how to grab the text after the slash.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could do this:
{{pullRequest.destinationBranch.repository.name.subStringAfter("/")}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.