From 48d957461ed1ab360971f5af822a45dcc66e31c2 Mon Sep 17 00:00:00 2001 From: Bryan Reymander Date: Thu, 16 Jul 2026 10:47:11 -0400 Subject: [PATCH] Fix CustomProperties calls renamed in octokit endpoint methods v17 @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 #981 --- lib/plugins/custom_properties.js | 6 +++--- .../unit/lib/plugins/custom_properties.test.js | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/plugins/custom_properties.js b/lib/plugins/custom_properties.js index 35f0144da..02a2540b9 100644 --- a/lib/plugins/custom_properties.js +++ b/lib/plugins/custom_properties.js @@ -39,7 +39,7 @@ module.exports = class CustomProperties extends Diffable { this.log.debug(`Getting all custom properties for the repo ${repoFullName}`) const customProperties = await this.github.paginate( - this.github.rest.repos.getCustomPropertiesValues, + this.github.rest.repos.customPropertiesForReposGetRepositoryValues, { owner, repo, @@ -110,14 +110,14 @@ module.exports = class CustomProperties extends Diffable { return new NopCommand( this.constructor.name, this.repo, - this.github.rest.repos.createOrUpdateCustomPropertiesValues.endpoint(params), + this.github.rest.repos.customPropertiesForReposCreateOrUpdateRepositoryValues.endpoint(params), `${operation} Custom Property` ) } try { this.log.debug(`${operation} Custom Property "${name}" for the repo ${repoFullName}`) - await this.github.rest.repos.createOrUpdateCustomPropertiesValues(params) + await this.github.rest.repos.customPropertiesForReposCreateOrUpdateRepositoryValues(params) this.log.debug(`Successfully ${operation.toLowerCase()}d Custom Property "${name}" for the repo ${repoFullName}`) } catch (e) { this.logError(`Error during ${operation} Custom Property "${name}" for the repo ${repoFullName}: ${e.message || e}`) diff --git a/test/unit/lib/plugins/custom_properties.test.js b/test/unit/lib/plugins/custom_properties.test.js index a9e878d58..7642e8f58 100644 --- a/test/unit/lib/plugins/custom_properties.test.js +++ b/test/unit/lib/plugins/custom_properties.test.js @@ -17,8 +17,8 @@ describe('CustomProperties', () => { paginate: jest.fn(), rest: { repos: { - getCustomPropertiesValues: jest.fn(), - createOrUpdateCustomPropertiesValues: jest.fn() + customPropertiesForReposGetRepositoryValues: jest.fn(), + customPropertiesForReposCreateOrUpdateRepositoryValues: jest.fn() } } } @@ -49,7 +49,7 @@ describe('CustomProperties', () => { const result = await plugin.find() expect(github.paginate).toHaveBeenCalledWith( - github.rest.repos.getCustomPropertiesValues, + github.rest.repos.customPropertiesForReposGetRepositoryValues, { owner, repo, @@ -100,14 +100,14 @@ describe('CustomProperties', () => { return plugin.sync().then(() => { expect(github.paginate).toHaveBeenCalledWith( - github.rest.repos.getCustomPropertiesValues, + github.rest.repos.customPropertiesForReposGetRepositoryValues, { owner, repo, per_page: 100 } ) - expect(github.rest.repos.createOrUpdateCustomPropertiesValues).not.toHaveBeenCalledWith({ + expect(github.rest.repos.customPropertiesForReposCreateOrUpdateRepositoryValues).not.toHaveBeenCalledWith({ owner, repo, properties: [ @@ -117,7 +117,7 @@ describe('CustomProperties', () => { } ] }) - expect(github.rest.repos.createOrUpdateCustomPropertiesValues).toHaveBeenCalledWith({ + expect(github.rest.repos.customPropertiesForReposCreateOrUpdateRepositoryValues).toHaveBeenCalledWith({ owner, repo, properties: [ @@ -127,7 +127,7 @@ describe('CustomProperties', () => { } ] }) - expect(github.rest.repos.createOrUpdateCustomPropertiesValues).toHaveBeenCalledWith({ + expect(github.rest.repos.customPropertiesForReposCreateOrUpdateRepositoryValues).toHaveBeenCalledWith({ owner, repo, properties: [ @@ -137,7 +137,7 @@ describe('CustomProperties', () => { } ] }) - expect(github.rest.repos.createOrUpdateCustomPropertiesValues).toHaveBeenCalledWith({ + expect(github.rest.repos.customPropertiesForReposCreateOrUpdateRepositoryValues).toHaveBeenCalledWith({ owner, repo, properties: [ @@ -152,7 +152,7 @@ describe('CustomProperties', () => { // const plugin = configure([{ name: 'Test', value: 'test' }]) // await plugin.update({ name: 'test', value: 'old' }, { name: 'test', value: 'test' }) - // expect(github.rest.repos.createOrUpdateCustomPropertiesValues).toHaveBeenCalledWith({ + // expect(github.rest.repos.customPropertiesForReposCreateOrUpdateRepositoryValues).toHaveBeenCalledWith({ // owner, // repo, // properties: [