|
| 1 | +# Manage github organisation membership with Google Workspace user accounts |
| 2 | + |
| 3 | +[](https://snyk.io/test/github/appvia/githubUserManager) |
| 4 | +[](https://github.com/appvia/githubUserManager/blob/main/LICENSE) |
| 5 | +[](https://github.com/appvia/githubusermanager/stargazers) |
| 6 | +[](https://github.com/appvia/githubusermanager/network) |
| 7 | +[](https://github.com/appvia/githubusermanager/issues) |
| 8 | +[](https://github.com/appvia/githubUserManager/actions/workflows/ci.yml) |
| 9 | + |
| 10 | +Manages who is in your GitHub organization based on a custom property in their Google Workspace profile, allowing for seamless JML (Joiner mover leaver) process, if allowed removing/disabling an account in the Google Workspace will remove the user from the GitHub; similarly adding a user also works the same way. If you don't want to run it in destructive mode it can be configured to exit with a non-zero exit code so that you know to go and manually make the changes. |
| 11 | + |
| 12 | +Right now this only handles the organization membership, it **does not** touch team membership, or level of membership; the main focus is to draw alert when the configuration isn't as expected, these features could be added in future. |
| 13 | + |
1 | 14 | ## Deployment |
2 | 15 |
|
| 16 | +### Collect the secrets |
| 17 | + |
3 | 18 | 1. [Add a custom attribute on the users](https://support.google.com/a/answer/6208725?hl=en#zippy=%2Cadd-a-new-custom-attribute) |
4 | 19 |
|
5 | 20 | 1. Go to https://admin.google.com/ac/customschema |
|
62 | 77 | 1. Click `Install` |
63 | 78 | - take node of the url, it'll look something like: `github.com/organizations/myorg/settings/installations/15627551`, the installationId is the last number `15627551` |
64 | 79 |
|
65 | | -## RUN |
| 80 | +### Run |
| 81 | + |
| 82 | +#### Github Action: |
| 83 | + |
| 84 | +```yaml |
| 85 | +# ./github/workflows/org-membership.yml |
| 86 | +name: Github Org Membership |
| 87 | + |
| 88 | +on: |
| 89 | + schedule: |
| 90 | + - cron: '*/5 * * * *' |
| 91 | +jobs: |
| 92 | + run: |
| 93 | + runs-on: ubuntu-latest |
| 94 | + steps: |
| 95 | + - name: Github Org Membership Manager |
| 96 | + uses: appvia/githubUserManager@v1 |
| 97 | + with: |
| 98 | + google-email-address: hello@example.com |
| 99 | + google-credentials: ${{ secrets.GOOGLE_CREDENTIALS }} |
| 100 | + add-users: 'false' |
| 101 | + remove-users: 'false' |
| 102 | + exit-code-on-missmatch: '1' |
| 103 | + github-org: 'myorg' |
| 104 | + github-app-id: 1234 |
| 105 | + github-installation-id: 12345 |
| 106 | + github-private-key: ${{ secrets.GITHUB_PRIVATE_KEY }} |
| 107 | + ignored-users: user1,user2 |
| 108 | +``` |
| 109 | +
|
| 110 | +#### Docker |
| 111 | +
|
| 112 | +1. make an [env file](https://www.digitalocean.com/community/tutorials/how-to-read-and-set-environmental-and-shell-variables-on-linux) with the [below table](#Setup-environment-variables) |
| 113 | +1. `docker run --env-file .env docker.pkg.github.com/appvia/githubusermanager/githubusermanager:main` |
| 114 | + |
| 115 | +#### node/lambda/cloud run/ something else |
| 116 | + |
| 117 | +1. clone this repo |
| 118 | +1. `npm install --production` |
| 119 | +1. `npm start` (with the with the [below environment variables table](#Setup-environment-variables) set) |
66 | 120 |
|
67 | 121 | ### Setup environment variables |
68 | 122 |
|
|
0 commit comments