Skip to content

Instantly share code, notes, and snippets.

@jdschleicher
jdschleicher / branch_protections_as_code.ps1
Last active April 9, 2024 12:10
POWERSHELL SETUP AND SCRIPT FOR BRANCH PROTECTIONS AS CODE IN GITHUB REPOSITORIES
<#
PREREQUISITES:
1. GITHUB CLI IS INSTALLED IN YOUR MACHINE (https://cli.github.com/)
2. GITHUB CLI IS AUTHENTICATED (https://cli.github.com/manual/gh_auth_login) USING THE WEB BROWSER LOGIN IS REALLY SIMPLE IF ALREADY LOGGED IN BROWSER
3. KNOW YOUR GITHUB USERNAME OR GITHUB ORGANIZATION NAME
4. IF USING BYPASS ADMIN TEAM IN EXAMPLE BELOW, GET TEAM SLUG BY GOING TO TEAM AND GRABBING SLUG NAME FROM URL
DOCUMENTATION FOR CREATING BRANCH PROTECTOIN WITH GRAPH QL: https://docs.github.com/en/graphql/reference/mutations#createbranchprotectionrule
@jdschleicher
jdschleicher / snowfakery_one_pager.md
Last active September 22, 2023 02:12
SNOWFAKERY ONE PAGER
@jdschleicher
jdschleicher / crm_example_permSetsReplacementByPersona
Created August 16, 2022 15:48
Remove List of Permission Sets and/or Permission Set Groups by Customer Persona and Replace with updated list of Customer Persona Permission Sets and/or Permission Set Groups
// **** THIS SCRIPT WILL START OFF BY DELETING ALL ASSIGNMENTS OF THE BELOW PERMISSION SETS IN VARIABLE personaToPermissionSetsToRemove AGAINST THE TARGETED ORG ***
// **** THIS SCRIPT IS INTENDED TO SWITCH OUT PERM SETS AND PERM SET GROUPS IN THE REMOVE MAP VARIABLE WITH THE PERM SETS AND PERM SET GROUPS IN THE REPLACE MAP VARIABLE****
// **** NOTE -- PERMISSION SETS AND PERMISSION SET GROUPS ARE INTERCHANGEABLE FOR PERMISSIOSETASSIGNMENTS
// STEP #1 - Get all Permission Sets and Permission Set Group API Names that will be Removed AND Added from/to Users
List<String> allPermissionSetAndPermissionSetGroupAPINames = new List<String> {
'Account_ReadOnly',
#!/bin/bash
### BELOW PREREQUISITE CHECKLIST TO ENSURE ALL CLI'S AND EXPECTED VALUES ARE CORRECTLY SETUP
#################### BEGIN SCRIPT LOGIC #############################
REPOSITORY_OWNER="jdschleicher"
TEMPLATE_NAME="setup-github-salesforce-dx-unlocked-package-template"
DEVHUB_ALIAS="your-devhub"
ORG_NAME="Company"
IS_PUBLIC_REPOSITORY=true #if repository is not a pro github account and is private then the brahcn protection rules features will not be enabled
@jdschleicher
jdschleicher / permissionSetAssignmentRemovalByAPIName
Created March 2, 2022 17:45
In the event of a refactor or another scenario where we want to remove permission set assignments from a list of specific users or all users in an environment
List<String> permissionSetAPINamesToRemove = new List<String>{
'permset_api_name_one',
'other_permset_api_name'
};
List<String> userIdsToRemoveAssignment = new List<String>{
'18characteruserid',
'18characteruseridTwo'
};
@jdschleicher
jdschleicher / gist:d9f25d449316926862b1804fe88a0899
Last active November 18, 2020 15:20
Bulk Agile Accelerator to Copado User Story Creation
Id agileAcceleratorScrumTeamCurrentSprintId = 'sprintidfromagileaccelerator';
Id copadosScrumTeamProjectId = 'projectidfromcopado';
Id copadosScrumTeamsDevOrgCredentialId = 'devorgidfromcopado';
Id copadoReleaseId = 'releaseidfromcopado';
List<agf__ADM_Work__c> agileAcceleratorWorkItems = [
SELECT
agf__Age__c,