fix: send minimal payload when archiving repositories - #3621
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
👋 Hi, and thank you for this contribution! 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 joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions. 🤖 This is an automated message. |
|
Not a maintainer — helping with review triage, so this is a comment rather than an approving review. The change looks correct to me. Two things I verified that may save you time:
One suggestion: the acceptance test runs the archive path at teardown but asserts nothing about the outcome. A I have not run the acceptance tests. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Thanks for the suggestion. I added a CheckDestroy assertion that fetches the repository after Terraform destroy and verifies that it is archived. The unit test still verifies the exact minimal PATCH payload. Unit tests and the build pass locally. |
Resolves #3620
Before the change?
When
archive_on_destroywas enabled, the delete path built a full repository update payload. Re-sendingsecurity_and_analysiscaused GitHub to reject the request with HTTP 422 when an organization-enforced security configuration was applied, even though the repository was archived.After the change?
The archive request contains only
{archived:true}. The regression test verifies the exact PATCH payload while security settings are present in Terraform state, and the acceptance test now exercises the archive-on-destroy path.Pull request checklist
Does this introduce a breaking change?
Testing
go test ./... -timeout=30s -parallel=4 -skip '^TestAcc' -count=1go build ./...AI use
This focused change was implemented with GitHub Copilot assistance and reviewed and tested locally before submission.