Allow configuring autolink references at organization level #12386
Replies: 24 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.
-
Here's the workaround that I used: While this is still waiting for implementation, the workaround that I used was quite simple:
With the help of ChatGPT or similar tools creation of this script in any language will take 1h at max, which still saves a lot of time if your have hundreds of repos and jira projects (also add a handler for rate limiting error to wait the number of seconds returned by the API, as GitHub has a default limit of 5k request in an hour, which is not that much) I have hundreds of repos and a lot of projects, so this takes a while, but at least it works. Currently periodically run it manually, but want to create some cron job |
Beta Was this translation helpful? Give feedback.
-
It appears there's significant demand for this feature, and I've encountered a similar issue myself. GitHub provides configuration options at both the organizational and repository levels for rulesets, so implementing this should be feasible. I encourage everyone to vote on the original comment in this discussion. Doing so should help GitHub staff recognize the demand and prioritize this request accordingly. |
Beta Was this translation helpful? Give feedback.
-
Just wanted to add my voice to the chorus of those calling for this... yes it is not too hard to implement per-repo with Terraform (and we do have this setup using both Jira and GitHub providers), but in our modest case use it takes 9 minutes to run on GitHub hosted runners given the # of projects & # of repos, which means we run it as a scheduled job which both adds latency as well as unnecessary runs vs doing it event driven. Seems like autolink references on an org level match the 80% use case as well. |
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.
-
+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.
-
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>' |
Beta Was this translation helpful? Give feedback.
-
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