-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(collaborators): listen to member changes #382
feat(collaborators): listen to member changes #382
Conversation
ping @decyjphr @martinm82 |
@anderssonjohan will work on it tomorrow. Thanks for the ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Should we update as well the README? |
lib/configManager.js
Outdated
this.context = context | ||
this.ref = ref | ||
this.log = log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be possible to use the logger through the context
?
this.log = log | |
this.log = context.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, great! I wasn't aware of that. I added this because of null references for this.log
when trying to run the tests in index.test.js. I'll push a change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, good catch, I obviously did not update all the places where ConfigManager were created in index.js! Fixup commit pushed (will rebase when review is done)
I just updated the PR description because these changes currently do not fix #251. It syncs memberships defined as policy, but the collaborators plugin does currently not remove any manually added members (users/teams). Thus, this PR should not auto-close the related issue until that part is added. |
@decyjphr @martinm82 I found the issue with members not being removed. In my config I have only teams and no collaborators 😅 . So for starters, I need to add I'll add a test that verifies that Example debugging session where I added manually added my github account to the repo with config set to This also means that users can enable this behavior (removal of manually added collaborators) by activating the plugin. If the want the collaborators to stay there is an option like in my previous config where I didn't use that plugin at all. |
Add listeners for repository collaborator events: - member - team Synchronizes settings when users or teams are added, removed, and when permissions for a member is changed.
Fix for empty collaborators config not removing excess members. Using config `collaborators: []` this fix makes sure that manually added collaborators are removed.
0735b35
to
852fa64
Compare
@decyjphr @martinm82 Now the PR is complete in terms of fixing #251. A small note on the fix for compareDeep: I first made a version where the source and target were swapped if the source was empty. In that way the recursive call would loop through the target instead and produce the same diff as in a case where GitHub "is empty" and config is not. That, however, made one test fail for compareDeep so my commit only ensures that What we had before:
What we have now is:
I even started to look at lodash |
I think my fixes here for empty list of collaborators also fixes the problem described by #301 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. 🚢
part offixes #251Add listeners for repository collaborator events:
Synchronizes settings when users or teams are added, removed, and when permissions for a member is changed.
Also includes minor fix to index.test.js to make the tests run.
Tasks