nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: probot/settings
Pull request #175 (2019-11-13 19:56:03)

fixed team_id field in removing team permissions
Changes
- Changed `id` to `team_id` in the remove repo function call

This should fix the second error in https://github.com/probot/settings/issues/172



Patch:
diff --git a/lib/plugins/teams.js b/lib/plugins/teams.js
index fb3c5d4..0d4929d 100644
--- a/lib/plugins/teams.js
+++ b/lib/plugins/teams.js
@@ -31,9 +31,7 @@ module.exports = class Teams extends Diffable {
   }
 
   remove (existing) {
-    return this.github.teams.removeRepo(
-      Object.assign({ id: existing.id }, this.repo)
-    )
+    return this.github.teams.removeRepo({ team_id: existing.id, ...this.repo })
   }
 
   toParams (existing, attrs) {


Test patch:
diff --git a/test/lib/plugins/teams.test.js b/test/lib/plugins/teams.test.js
index 87f2422..d3d84a9 100644
--- a/test/lib/plugins/teams.test.js
+++ b/test/lib/plugins/teams.test.js
@@ -62,7 +62,7 @@ describe('Teams', () => {
         expect(github.teams.removeRepo).toHaveBeenCalledWith({
           owner: 'bkeepers',
           repo: 'test',
-          id: 2
+          team_id: 2
         })
 
         expect(github.teams.removeRepo).toHaveBeenCalledTimes(1)
Repository: probot/settings
Pull request #216 (2020-03-15 20:45:37)

perf(config-fetch): removed the unused fetch of the config file
the response was unused since the config was used from the previous load using context.config


Patch:
diff --git a/lib/settings.js b/lib/settings.js
index ab90389..4549833 100644
--- a/lib/settings.js
+++ b/lib/settings.js
@@ -1,12 +1,6 @@
 class Settings {
   static sync (github, repo, config) {
-    return github.repos.getContents({
-      owner: repo.owner,
-      repo: repo.repo,
-      path: Settings.FILE_NAME
-    }).then(res => {
-      return new Settings(github, repo, config).update()
-    })
+    return new Settings(github, repo, config).update()
   }
 
   constructor (github, repo, config) {


Test patch:
diff --git a/test/integration/push.test.js b/test/integration/push.test.js
index 995ca95..00a756c 100644
--- a/test/integration/push.test.js
+++ b/test/integration/push.test.js
@@ -40,9 +40,6 @@ describe('push', function () {
     const configFile = Buffer.from(fs.readFileSync(pathToConfig, 'utf8'))
     const config = yaml.safeLoad(configFile, 'utf8')
     const encodedConfig = configFile.toString('base64')
-    githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
-      .reply(200, { content: encodedConfig, name: 'settings.yml', type: 'file' })
     githubScope
       .get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
       .reply(200, { content: encodedConfig, name: 'settings.yml', type: 'file' })
@@ -68,9 +65,6 @@ describe('push', function () {
     const pathToConfig = path.resolve(__dirname, '..', 'fixtures', 'collaborators-config.yml')
     const configFile = Buffer.from(fs.readFileSync(pathToConfig, 'utf8'))
     const encodedConfig = configFile.toString('base64')
-    githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
-      .reply(OK, { content: encodedConfig, name: 'settings.yml', type: 'file' })
     githubScope
       .get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
       .reply(OK, { content: encodedConfig, name: 'settings.yml', type: 'file' })
@@ -107,9 +101,6 @@ describe('push', function () {
     const pathToConfig = path.resolve(__dirname, '..', 'fixtures', 'teams-config.yml')
     const configFile = Buffer.from(fs.readFileSync(pathToConfig, 'utf8'))
     const encodedConfig = configFile.toString('base64')
-    githubScope
-      .get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
-      .reply(OK, { content: encodedConfig, name: 'settings.yml', type: 'file' })
     githubScope
       .get(`/repos/${repository.owner.name}/${repository.name}/contents/${settings.FILE_NAME}`)
       .reply(OK, { content: encodedConfig, name: 'settings.yml', type: 'file' })
Repository: probot/settings
Pull request #221 (2020-04-08 13:44:24)

fix: return promises in map call to prevent floating promises
The branches settings have a subtle error where a map call doesn't actually map into anything but rather creates floating Promises. This PR returns the Promise so that promise rejections can be handled properly in calling code


Patch:
diff --git a/lib/plugins/branches.js b/lib/plugins/branches.js
index 428ac0c..39f7785 100644
--- a/lib/plugins/branches.js
+++ b/lib/plugins/branches.js
@@ -15,10 +15,10 @@ module.exports = class Branches {
           const params = Object.assign(this.repo, { branch: branch.name })
 
           if (this.isEmpty(branch.protection)) {
-            this.github.repos.removeBranchProtection(params)
+            return this.github.repos.removeBranchProtection(params)
           } else {
             Object.assign(params, branch.protection, { headers: previewHeaders })
-            this.github.repos.updateBranchProtection(params)
+            return this.github.repos.updateBranchProtection(params)
           }
         })
     )


Test patch:
diff --git a/test/unit/lib/plugins/branches.test.js b/test/unit/lib/plugins/branches.test.js
index 2087621..3bb98bf 100644
--- a/test/unit/lib/plugins/branches.test.js
+++ b/test/unit/lib/plugins/branches.test.js
@@ -11,8 +11,8 @@ describe('Branches', () => {
   beforeEach(() => {
     github = {
       repos: {
-        updateBranchProtection: jest.fn().mockImplementation(() => Promise.resolve()),
-        removeBranchProtection: jest.fn().mockImplementation(() => Promise.resolve())
+        updateBranchProtection: jest.fn().mockImplementation(() => Promise.resolve('updateBranchProtection')),
+        removeBranchProtection: jest.fn().mockImplementation(() => Promise.resolve('removeBranchProtection'))
       }
     }
   })
@@ -177,4 +177,33 @@ describe('Branches', () => {
       })
     })
   })
+
+  describe('return values', () => {
+    it('returns updateBranchProtection Promise', () => {
+      const plugin = configure(
+        [{
+          name: 'master',
+          protection: { enforce_admins: true }
+        }]
+      )
+
+      return plugin.sync().then(result => {
+        expect(result.length).toBe(1)
+        expect(result[0]).toBe('updateBranchProtection')
+      })
+    })
+    it('returns removeBranchProtection Promise', () => {
+      const plugin = configure(
+        [{
+          name: 'master',
+          protection: null
+        }]
+      )
+
+      return plugin.sync().then(result => {
+        expect(result.length).toBe(1)
+        expect(result[0]).toBe('removeBranchProtection')
+      })
+    })
+  })
 })