Skip to content

[MAINT]: Detect not-found via the error (errors.AsType) in github_team_repository delete #3523

Closed

Description

@rilical

Describe the need

While reviewing #3518 (a fix for a nil-pointer panic in resourceGithubTeamRepositoryDelete), @stevehipwell noted that the delete function's error handling should be reworked:

the error handling in this function isn't correctly implemented and there also appears to be unnecessary complexity. This whole block needs updating to check for an error and then use errors.AsType to check for a GitHub error with a response.

This tracks that follow-up. resourceGithubTeamRepositoryDelete currently detects the not-found case by reading resp.StatusCode off the raw HTTP *github.Response. It should instead inspect the returned error via errors.AsType[*github.ErrorResponse](err), matching the resource's own Read function and the pattern already used across the provider (for example resource_github_issue_label.go and util_retry.go).

Keying off the error rather than the response:

  • removes the need to nil-check the response (a transport error yields a nil *github.Response), and
  • aligns with the errorlint linter that is enabled for this repository.

The repository-rename recovery and archived-repository handling should be preserved.

Reference: review feedback on #3518.

Relevant log output

N/A

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. github-actions commented on Jul 6, 2026

    @github-actions

    👋 Hi, and thank you for opening this issue!

    This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can.

    You can help us prioritize by adding details, reproduction steps, or a 👍 to issues that matter to you, and by joining the discussion on open issues and PRs.


    🤖 This is an automated message.

  2. added
    Type: Maintenance
    on Jul 6, 2026
  3. modified the milestones: v6.14.0, v6.13.0 on Jul 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type: Maintenance

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions