Skip to content

Commit 291de8c

Browse files
authored
Merge branch 'github:main-enterprise' into main-enterprise
2 parents c2e890b + b0805f0 commit 291de8c

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

app.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,9 @@ default_permissions:
114114
# https://developer.github.com/v3/apps/permissions/
115115
organization_administration: write
116116

117-
# Manage Actions repository variables.
118-
# https://developer.github.com/v3/apps/permissions/#repository-permissions-for-variables
119-
variables: write
117+
# Manage Actions variables.
118+
# https://docs.github.com/en/rest/actions/variables?apiVersion=2022-11-28
119+
actions_variables: write
120120

121121

122122
# The name of the GitHub App. Defaults to the name specified in package.json

lib/plugins/collaborators.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@ module.exports = class Collaborators extends Diffable {
1515
}
1616

1717
find () {
18-
// this.log.debug(`Finding collaborators for { repo: ${this.repo.repo}, owner: ${this.repo.owner}, affiliation: 'direct', 'outside', and 'pending invites' }`)
18+
// https://docs.github.com/en/rest/collaborators/collaborators?apiVersion=2022-11-28
19+
// 'outside' means all outside collaborators of an organization-owned repository.
20+
// 'direct' means all collaborators with permissions to an organization-owned repository, regardless of organization membership status. (includes outside collaborators)
21+
// 'all' means all collaborators the authenticated user can see.
22+
// We are using 'direct' to avoid double listing users outside collaborators and team members.
1923
return Promise.all([this.github.repos.listCollaborators({ repo: this.repo.repo, owner: this.repo.owner, affiliation: 'direct' }),
20-
this.github.repos.listCollaborators({ repo: this.repo.repo, owner: this.repo.owner, affiliation: 'outside' }),
2124
this.github.repos.listInvitations({ repo: this.repo.repo, owner: this.repo.owner })])
2225
.then(res => {
2326
const mapCollaborator = user => {
@@ -31,9 +34,8 @@ module.exports = class Collaborators extends Diffable {
3134
}
3235
}
3336

34-
const results0 = (res[0].data || []).map(mapCollaborator)
35-
const results1 = (res[1].data || []).map(mapCollaborator)
36-
const results2 = (res[2].data || []).map(invite => {
37+
const results1 = (res[0].data || []).map(mapCollaborator)
38+
const results2 = (res[1].data || []).map(invite => {
3739
return {
3840
// Force all usernames to lowercase to avoid comparison issues.
3941
username: invite.invitee.login.toLowerCase(),
@@ -44,7 +46,7 @@ module.exports = class Collaborators extends Diffable {
4446
(invite.permissions === 'write' && 'push')
4547
}
4648
})
47-
return results0.concat(results1).concat(results2)
49+
return results1.concat(results2)
4850
})
4951
.catch(e => {
5052
this.logError(e)

lib/plugins/diffable.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ module.exports = class Diffable extends ErrorStash {
9090
const mergeDeep = new MergeDeep(this.log, this.github, ignorableFields)
9191
const compare = mergeDeep.compareDeep(existingRecords, filteredEntries)
9292
const results = { msg: 'Changes found', additions: compare.additions, modifications: compare.modifications, deletions: compare.deletions }
93-
this.log.debug(`Results of comparing ${this.constructor.name} diffable target ${JSON.stringify(existingRecords)} with source ${JSON.stringify(filteredEntries)} is ${results}`)
93+
this.log.debug(`Results of comparing ${this.constructor.name} diffable target ${JSON.stringify(existingRecords)} with source ${JSON.stringify(filteredEntries)} is ${JSON.stringify(results)}`)
9494
if (!compare.hasChanges) {
95-
this.log.debug(`There are no changes for ${this.constructor.name} for repo ${this.repo}. Skipping changes`)
95+
this.log.debug(`There are no changes for ${this.constructor.name} for repo ${this.repo.repo}. Skipping changes`)
9696
return Promise.resolve()
9797
} else {
9898
if (this.nop) {

0 commit comments

Comments
 (0)