Skip to content

Conversation

@limakzi
Copy link

@limakzi limakzi commented Apr 17, 2025

Resolves #2627


Before the change?

  • Fails to refresh for non-existing repository.

After the change?

  • Removes an anchor for non-existing repository.

Pull request checklist

  • 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

@limakzi limakzi force-pushed the bugfix/link-for-non-existing-repo branch from 0106ddb to 2b53c7d Compare April 17, 2025 23:31
@nickfloyd nickfloyd moved this from 🆕 Triage to 👀 In review in 🧰 Octokit Active Jun 3, 2025
@limakzi
Copy link
Author

limakzi commented Jun 20, 2025

@nickfloyd, Is there anything I can do to help you in review?

@limakzi limakzi force-pushed the bugfix/link-for-non-existing-repo branch from 2b53c7d to 1371ac8 Compare July 3, 2025 12:56
@limakzi limakzi force-pushed the bugfix/link-for-non-existing-repo branch from 1371ac8 to da4ae89 Compare October 24, 2025 08:08
Copilot AI review requested due to automatic review settings October 24, 2025 08:08
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes an issue where the github_repository_autolink_reference resource fails to refresh when the parent repository no longer exists. The fix adds a repository existence check before attempting to retrieve the autolink reference.

  • Adds pre-check to verify repository exists before fetching autolink reference
  • Removes the autolink reference from Terraform state when repository is not found
  • Handles NotModified status appropriately to support ETags

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

return nil
}
if ghErr.Response.StatusCode == http.StatusNotFound {
log.Printf("[INFO] Removing autolink reference from state because repository %s/%s no longer exists in GitHub",
Copy link

Copilot AI Oct 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two spaces between 'repository' and '%s/%s'. Remove the extra space.

Suggested change
log.Printf("[INFO] Removing autolink reference from state because repository %s/%s no longer exists in GitHub",
log.Printf("[INFO] Removing autolink reference from state because repository %s/%s no longer exists in GitHub",

Copilot uses AI. Check for mistakes.
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.

[BUG]: autolink_reference fails to be removed for non-existing repository

1 participant