Skip to content

fix: import or update autolinks on creation#3394

Open
acouvreur wants to merge 1 commit intointegrations:mainfrom
acouvreur:auto-import-autolinks
Open

fix: import or update autolinks on creation#3394
acouvreur wants to merge 1 commit intointegrations:mainfrom
acouvreur:auto-import-autolinks

Conversation

@acouvreur
Copy link
Copy Markdown
Contributor

Resolves #2565


Before the change?

Creating a github_repository_autolink_reference resource whose key_prefix already existed in the repository failed immediately with a 422 Unprocessable Entity error from the GitHub API. There was no way to adopt an existing autolink into Terraform state through a normal apply; the only workaround was a manual terraform import.

After the change?

The Create function now looks up existing autolinks by key_prefix before calling the GitHub API:

  • Same settings (target_url_template and is_alphanumeric match): the existing autolink is silently imported into state, making the operation idempotent.
  • Different settings: the existing autolink is deleted first, then a new one is created with the desired configuration, providing an in-place update on first apply.
  • No existing autolink: behaviour is unchanged; the autolink is created normally.

Pull request checklist

  • Schema migrations have been created if needed (example)
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)

Does this introduce a breaking change?

Please see our docs on breaking changes to help!

  • Yes
  • No

AI Disclaimer: This was developed with the help of Claude Sonnet 4.6

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with Status: Up for grabs. You & others like you are the reason all of this works! So thank you & happy coding! 🚀

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

Successfully merging this pull request may close these issues.

[FEAT]: Automatically import autolinks when trying to create one for a repository

1 participant