Skip to content

Instantly share code, notes, and snippets.

Last active July 12, 2021 13:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Add\remove user automatically to JFrog from a triggered github webhook call
exports.handler = async (event, context, callback) => {
baseJFrogURL = '',
request = event.Records[0].cf.request,
body = request.body;
switch (body.action) {
case 'added':
const orgEmailAddress = useJeffUserQueryHere(body.member.login) // Your place to shine!
const payload = {
"schemas": [
"userName": orgEmailAddress,
"active": true,
"internalPasswordDisabled": true,
"admin": true, // Need to figure out from where to fetch this one?
"emails": [
"value": orgEmailAddress,
"primary": true
"groups": [
"readers",, // As long as our names are the same!
`${}-admin` // If admin!
const response = await fetch(`${baseJFrogURL}/api/v1/scim/v2/Users`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
}, body: JSON.stringify(payload),
}).then(res => res.ok ? res.json : false)
return callback(null, response);
case 'removed':
// Probably the same as above
Copy link

cuperman commented Jul 9, 2021

oh interesting idea. you want us to use github as the source of truth for our users, and automatically propagate users to our other cloud tools?

Copy link

Indeed, then again, as we're managing users via Azure-AD, maybe it makes more sense to trigger the same from AD based on the user's security groups

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment