Allow configuring autolink references at organization level #12386
Replies: 34 comments 12 replies
-
If you have quite a few repositories you'd like auto links for, the create an autolink reference for a repository REST API endpoint might be useful. |
Beta Was this translation helpful? Give feedback.
-
Sorry for the bump here, any updates? |
Beta Was this translation helpful? Give feedback.
-
It would be ideal if there was a configuration option available at the organization level for autolinking references |
Beta Was this translation helpful? Give feedback.
-
@github-staff Any update on this? This would be a very useful feature. |
Beta Was this translation helpful? Give feedback.
-
Hi Team, Any update on this? |
Beta Was this translation helpful? Give feedback.
-
I don't know the internals, but a cheap alternative may be to allow file based configuration in something like |
Beta Was this translation helpful? Give feedback.
-
This would still be a great feature. In our organisation we have 200+ repo's. |
Beta Was this translation helpful? Give feedback.
-
🛑 Update about this solution 🛑As discovered by @s4nji, if your organization has a large number of repositories and/or you need to add a large number of autolink references, this solution probably won't work for you as you could easily hit GitHub's API rate limits. Check @s4nji's reply for more details. Original answer:I haven't tested it, but one option would be to use Terraform for this. You could fetch all repos of your org and then add the autolink references: locals {
projects = [
{
id = "TICKET"
url_template = "https://example.com/TICKET-<num>"
}
{
id = "PROJ"
url_template = "https://example.com/PROJ?query=<num>"
}
]
}
data "github_repositories" "your_org" {
query = "org:your_org"
}
resource "github_repository_autolink_reference" "autolink" {
for_each = {
for repo_project in setproduct(data.github_repositories.your_org.full_names, local.projects) : "repo:${repo_project[0]}|proj:${repo_project[1].id}" =>
{
repo_name = repo_project[0]
project_id = repo_project[1].id
project_url_template = repo_project[1].url_template
}
}
}
repository = each.value.repo_name
key_prefix = "${each.value.project_id}-"
target_url_template = each.value.project_url_template
} Besides having Terraform set up, a solution like this would require setting up authentication with GitHub using one of the available options and making sure the chosen option is authorized to see all your org's repos. References:
|
Beta Was this translation helpful? Give feedback.
-
Until this feature is created, we decided to decouple auto links from Terraform as it leads to too many resources. Here is a gist I created with the script in Python if it helps anyone else. |
Beta Was this translation helpful? Give feedback.
-
Adding another vote for this. I work for an organization that has over 7700 repositories in our GHE instance. This is a must for us to be able to make use of autolinks in a meaningful way. |
Beta Was this translation helpful? Give feedback.
-
Adding my vote for this. You can do it on Gitlab #justsayin |
Beta Was this translation helpful? Give feedback.
-
I was really surprised when found out that GH doesn't have a solution for this. Hope it'll be implemented soon |
Beta Was this translation helpful? Give feedback.
-
+1 for this feature |
Beta Was this translation helpful? Give feedback.
-
+1 for this feature |
Beta Was this translation helpful? Give feedback.
-
Big up from here! |
Beta Was this translation helpful? Give feedback.
-
+1 for this feature |
Beta Was this translation helpful? Give feedback.
-
+1 for this feature |
Beta Was this translation helpful? Give feedback.
-
I've been wishing for this for soooo long. Upvoted. |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
This might be a workaround for some people: there is safe-settings by GitHub, "an app to manage policy-as-code and apply repository settings to repositories across an organization". It's basically GitOps for GitHub. The settings file allows to enforce different policies at the repo, suborg (set of repos), or the org level. This includes autolinks settings, for instance: # See the docs (https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/configuring-autolinks-to-reference-external-resources) for a description of autolinks and replacement values.
autolinks:
- key_prefix: 'JIRA-'
url_template: 'https://jira.github.com/browse/JIRA-<num>'
- key_prefix: 'MYLINK-'
url_template: 'https://mywebsite.com/<num>' See: https://github.com/github/safe-settings?tab=readme-ov-file#the-settings-file |
Beta Was this translation helpful? Give feedback.
-
Here's a simple script to copy autolinks from one repo to all repos across an org https://gist.github.com/npwolf/d5acd0d2312a83714d85bb1c664cff1a . |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
👍 this would be very helpful, adding, editing, and removing a global changes from hundreds of repos is gross. Yes, we can API it up but its still a pretty fragile approach |
Beta Was this translation helpful? Give feedback.
-
+10000 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
+100000 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
As an organization owner,
I would like to setup auto-link references at the organization settings level
so that my teammates do not have to re-create them across all projects we have
Beta Was this translation helpful? Give feedback.
All reactions