Skip to content

refactor!: Pass repository creation by value - #4616

Merged
gmlewis merged 3 commits into
google:masterfrom
kimjooyoon:refactor/create-repository-value-request
Oct 13, 2026
Merged

gmlewis merged 3 commits into
google:masterfrom
kimjooyoon:refactor/create-repository-value-request

Conversation

@kimjooyoon

@kimjooyoon kimjooyoon commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RepositoriesService.Create now accepts CreateRepositoryRequest by value, with a required string Name and the existing optional fields. This separates creation input from the Repository response type. Callers now pass CreateRepositoryRequest{Name: "repo"}.

BREAKING CHANGE: RepositoriesService.Create now requires a CreateRepositoryRequest value instead of a *Repository argument.

Updates user/org request tests, README and code examples, integration setup, and generated helpers. Towards #3644; scope coordinated here.

Validation: script/generate.sh, script/fmt.sh, script/test.sh (all 12 modules, with race detection), and script/lint.sh passed on Go 1.27.2. Integration tests compile with -tags=integration -run=^$; no live integration tests were run. The existing AllowUpdateBranch and AllowForking fields are preserved and recorded as intentional schema-check exceptions; the pinned schemas produce no new findings.

AI assistance: Codex helped with implementation, tests, review, and this description.

@google-cla

google-cla Bot commented Oct 13, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@kimjooyoon
kimjooyoon marked this pull request as ready for review October 13, 2026 10:16
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Oct 13, 2026
@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.61%. Comparing base (e754d2c) to head (93b2814).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4616      +/-   ##
==========================================
- Coverage   98.61%   98.61%   -0.01%     
==========================================
  Files         199      199              
  Lines       18693    18664      -29     
==========================================
- Hits        18435    18406      -29     
  Misses        258      258              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you, @kimjooyoon!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @Not-Dhananjay-Mishra - @JamBalaya56562

@JamBalaya56562 JamBalaya56562 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this! A few things I found while checking it locally:

  1. README.md (the "Creating and Updating Resources" section) still has the old example passing &github.Repository{...} to Repositories.Create; only github/doc.go was updated. With this PR that snippet no longer compiles: cannot use repo (variable of type *github.Repository) as github.CreateRepositoryRequest value.
  2. Could you add a single-sentence BREAKING CHANGE: ... line to the description? It gets copied into the git history and release notes.
  3. script/check-schema-fields.sh reports AllowUpdateBranch and AllowForking as 2 new findings (not in the request body schema). Since they are kept on purpose, it may be worth recording them in tools/schemafields/exceptions.txt. FWIW, I confirmed against the live API that allow_update_branch sent on create is honored for both POST /user/repos and POST /orgs/{org}/repos, so keeping it looks right.

@kimjooyoon

Copy link
Copy Markdown
Contributor Author

Thanks @JamBalaya56562 — addressed all three points in 496d4a0:

  • Updated the README creation example to pass CreateRepositoryRequest by value, with a string Name, and corrected the surrounding pointer-field guidance.
  • Added the one-line BREAKING CHANGE: note to the PR description.
  • Recorded AllowUpdateBranch and AllowForking as intentional schema-check exceptions, with a comment explaining that they preserve fields previously available through Repository. The pinned-schema check now reports no new findings.

Validation: the README snippet compiles; script/fmt.sh, script/test.sh (all 12 modules, including race detection), and script/lint.sh pass. I also rechecked the rendered diff and description.

@JamBalaya56562 JamBalaya56562 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the quick update — all three points look resolved. I re-checked locally: the README snippet now compiles against this branch, script/check-schema-fields.sh reports no new findings, and the new comment in exceptions.txt survives -write-exceptions. LGTM.

Nit (non-blocking): README.md and github/doc.go used to have identical text in "Creating and Updating Resources". The README wording was updated in 496d4a0, but doc.go still describes only repository creation ("When creating a repository, …") rather than resource/request structs in general, so syncing it with the README would fix both the mismatch and the narrower scope.

@kimjooyoon

Copy link
Copy Markdown
Contributor Author

Thanks @JamBalaya56562 for the second review and the local checks! Synced the “Creating and Updating Resources” wording in github/doc.go with the README in 93b2814, including the general optional-field guidance and value-type CreateRepositoryRequest.Name.

script/fmt.sh, script/test.sh (all 12 modules with race detection), and script/lint.sh pass. I also rechecked the rendered diff and PR description.

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Oct 13, 2026
@gmlewis

gmlewis commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

Thank you, @kimjooyoon and @JamBalaya56562!
Merging.

@gmlewis
gmlewis merged commit c273cd8 into google:master Oct 13, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants