Skip to content

Fix CustomProperties plugin calls renamed in @octokit/plugin-rest-endpoint-methods v17#1032

Open
breymander wants to merge 1 commit into
github-community-projects:main-enterprisefrom
breymander:breymander/fix-custom-properties-octokit-v17
Open

Fix CustomProperties plugin calls renamed in @octokit/plugin-rest-endpoint-methods v17#1032
breymander wants to merge 1 commit into
github-community-projects:main-enterprisefrom
breymander:breymander/fix-custom-properties-octokit-v17

Conversation

@breymander

@breymander breymander commented Jul 16, 2026

Copy link
Copy Markdown

Summary

Fixes #981.

@octokit/plugin-rest-endpoint-methods v17.0.0 (resolved transitively via octokit@^5 / probot@^14) renamed the repository custom-properties methods as a documented breaking change:

Old (removed) New (v17)
repos.getCustomPropertiesValues repos.customPropertiesForReposGetRepositoryValues
repos.createOrUpdateCustomPropertiesValues repos.customPropertiesForReposCreateOrUpdateRepositoryValues

lib/plugins/custom_properties.js still called the old names, which broke the plugin in three ways:

  • Read (find()): paginate(undefined, …) falls back to GET https://api.github.com/ (the API root), so existing property values always read as empty and every configured property diffs as a brand-new addition on every repo, every sync.
  • Write (apply mode): every add() fails with …createOrUpdateCustomPropertiesValues is not a function. The error is caught and logged per property, so nothing crashes; custom properties are silently never applied, with one error line per repo per sync cycle.
  • Nop mode (PR validation): .endpoint(params) on the undefined method throws synchronously, which escapes Promise.all in Settings.updateRepos and crashes the process, leaving the check-run stuck IN_PROGRESS.

This is the same root cause as #971; the #978 fix patched normalize() but the renamed-method calls remained.

Changes

  • Rename the three call sites in lib/plugins/custom_properties.js to the v17 method names
  • Update the unit-test mocks in test/unit/lib/plugins/custom_properties.test.js to match

Deliberately kept minimal per the contributing guidelines: no behavior changes beyond restoring the intended API calls. I'm aware #990 rebuilds a broader set of fixes from 2.1.18; this PR just unblocks custom-properties sync in the meantime and should be trivial to carry or drop in that effort.

Verification

Note for maintainers

These endpoint operation IDs have now changed twice upstream. If you'd prefer the plugin to be immune to future renames, I'm happy to switch the calls to raw routes instead (octokit.request('GET /repos/{owner}/{repo}/properties/values') / ('PATCH …')). I went with the .rest namespace here to stay consistent with #949.

@octokit/plugin-rest-endpoint-methods v17.0.0 (pulled in transitively
by octokit@^5 / probot@^14) renamed the repository custom-properties
methods as a documented breaking change:

- repos.getCustomPropertiesValues
    -> repos.customPropertiesForReposGetRepositoryValues
- repos.createOrUpdateCustomPropertiesValues
    -> repos.customPropertiesForReposCreateOrUpdateRepositoryValues

The CustomProperties plugin still called the old names. The read side
fell back to paginating 'GET /' (the API root), so existing values
always came back empty and every configured property was treated as a
new addition; the write side then threw
'createOrUpdateCustomPropertiesValues is not a function' on every repo
on every sync. In nop mode the .endpoint() access on the undefined
method threw synchronously and crashed the process.

Rename the three call sites to the v17 method names and update the
unit-test mocks to match.

Fixes github-community-projects#981
Copilot AI review requested due to automatic review settings July 16, 2026 14:48

Copilot AI 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.

Pull request overview

Restores CustomProperties plugin compatibility with @octokit/plugin-rest-endpoint-methods v17 by updating renamed .rest.repos.* method calls, preventing silent read failures and crashes in nop/validation mode.

Changes:

  • Updated CustomProperties.find() to paginate using repos.customPropertiesForReposGetRepositoryValues.
  • Updated CustomProperties.modifyProperty() (nop + apply paths) to use repos.customPropertiesForReposCreateOrUpdateRepositoryValues.
  • Updated unit test mocks and expectations to match the new Octokit method names.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/plugins/custom_properties.js Renames Octokit REST endpoint method usages to the v17 operation IDs for repo custom-properties read/write.
test/unit/lib/plugins/custom_properties.test.js Aligns test mocks and assertions with the renamed Octokit REST endpoint methods.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2.1.21: CustomProperties plugin still crashes — modifyProperty() calls renamed octokit methods

2 participants