Skip to content

Commit df5794d

Browse files
committed
adding descriptions to scripts
1 parent a982b70 commit df5794d

16 files changed

+49
-19
lines changed

scripts/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ Delete branch protection rules programmatically based on a pattern.
7070

7171
## delete-repos-from-list.sh
7272

73+
Deletes a list of repositories.
74+
7375
1. Run: `./generate-repos-list.sh <org> > repos.csv`
7476
2. Clean up the `repos.csv` file and remove the repos you **don't want to delete**
7577
3. Run `./delete-repos-from-list.sh repos.csv`

scripts/add-codeowners-file-to-repositories.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/bash
2-
# DOT NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
32

4-
# Need to run this to get the repo delete scope: gh auth refresh -h github.com -s delete_repo
3+
# Adds a CODEOWNERS file to the default branch in a CSV list of repositories
54

65
# Usage:
76
# Step 1: Run ./generate-repos.sh <org> > repos.csv
8-
# (or create a list of repos in a csv file, 1 per line, with a trailing empty line at the end of the file)
7+
# - Or create a list of repos in a csv file, 1 per line, with a trailing empty line at the end of the file
8+
# - DO NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
99
# Step 2: ./add-codeowners-file-to-repositories.sh repos.csv ./CODEOWNERS false
1010
#
1111
# Overwrite or append:

scripts/add-gitignore-file-to-repositories.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/bin/bash
2-
# DOT NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
32

4-
# Need to run this to get the repo delete scope: gh auth refresh -h github.com -s delete_repo
3+
# Adds a .gitignore file to the default branch in a CSV list of repositories
54

65
# Usage:
76
# Step 1: Run ./generate-repos.sh <org> > repos.csv
8-
# (or create a list of repos in a csv file, 1 per line, with a trailing empty line at the end of the file)
7+
# - Or create a list of repos in a csv file, 1 per line, with a trailing empty line at the end of the file\
8+
# - DO NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
99
# Step 2: ./add-gitignore-file-to-repositories.sh repos.csv ./.gitignore false
1010
#
1111
# Overwrite or append:

scripts/add-users-to-team-from-list.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/bash
2-
# DOT NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
2+
3+
# Adds users to an organization team from a CSV input list
34

45
# Usage:
56
# Step 1: Create a list of users in a csv file, 1 per line, with a trailing empty line at the end of the file
7+
# - DO NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
68
# Step 2: ./add-users-to-team-from-list.sh users.csv <org> <team>
79

810
if [ $# -lt "3" ]; then

scripts/create-enterprise-organizations.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/bash
2-
# DOT NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
2+
3+
# Creates organizations in an enterprise from a CSV input list (orgs-to-create.csv)
4+
5+
# DO NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
36

47
# Use ../gh-cli/get-enterprise-id.sh to get the enterprise id to use here
58

scripts/create-teams-from-list.sh

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
#!/bin/bash
2-
# DOT NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
2+
3+
# Creates teams in an organization from a CSV input list
34

45
# Need to run this to be able to create teams: gh auth refresh -h github.com -s admin:org
56

67
# Usage:
78
# Step 1: Create a list of teams in a csv file, 1 per line, with a trailing empty line at the end of the file
8-
# - child teams should have a slash in the name, e.g. test1-team/test1-1-team
9-
# - build out the parent structure in the input file before creating the child teams;
10-
# e.g. have the 'test1-team' come before 'test1-team/test1-1-team' in the file
9+
# - child teams should have a slash in the name, e.g. test1-team/test1-1-team
10+
# - build out the parent structure in the input file before creating the child teams;
11+
# e.g. have the 'test1-team' come before 'test1-team/test1-1-team' in the file
12+
# - DO NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
1113
# Step 2: ./create-teams-from-list.sh teams.csv <org>
1214

1315
# Example input file:
@@ -16,7 +18,7 @@
1618
# test22-team
1719
# test11-team/test11111-team
1820
# test11-team/test11111-team/textxxx-team
19-
21+
#
2022

2123
if [ $# -lt "2" ]; then
2224
echo "Usage: $0 <teams-file-name> <org>"

scripts/delete-repos-from-list.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#!/bin/bash
2-
# DOT NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
2+
3+
# Deletes repos from a CSV input list
34

45
# Need to run this to get the repo delete scope: gh auth refresh -h github.com -s delete_repo
56

67
# Usage:
78
# Step 1: Run ./generate-repos.sh <org> > repos.csv
8-
# (or create a list of repos in a csv file, 1 per line, with a trailing empty line at the end of the file)
9+
# - Or create a list of repos in a csv file, 1 per line, with a trailing empty line at the end of the file
10+
# - DO NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
911
# Step 2: ./delete-repos-from-list.sh repos.csv
1012

1113
if [ $# -lt "1" ]; then

scripts/delete-teams-from-list.sh

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#!/bin/bash
2-
# DOT NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
2+
3+
# Deletes teams in an organization from a CSV input list
34

45
# Need to run this to be able to delete teams: gh auth refresh -h github.com -s admin:org
56

67
# Usage:
78
# Step 1: Create a list of teams in a csv file, 1 per line, with a trailing empty line at the end of the file
8-
# - child teams should have a slash in the name, e.g. test1-team/test1-1-team
9-
# - !!! Important !!! Note that if a team has child teams, all of the child teams will be deleted as well
9+
# - child teams should have a slash in the name, e.g. test1-team/test1-1-team
10+
# - !!! Important !!! Note that if a team has child teams, all of the child teams will be deleted as well
11+
# - DO NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
1012
# Step 2: ./delete-teams-from-list.sh teams.csv <org>
1113

1214
# Example input file:

scripts/gei-clean-up-azure-storage-account.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Cleans up containers from a storage account older than a specified time
4+
35
# modified from https://learn.microsoft.com/en-us/azure/storage/scripts/storage-blobs-container-delete-by-prefix-cli#run-the-script
46
# requires GNU date.
57
# if using a mac: `brew install coreutils`

scripts/generate-repos-list.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Generates a list of repositories in an organization to a CSV file
4+
35
# Usage: ./generate-repos.sh <org> > csv.csv
46

57
# Credits to @tspascoal from this repo: https://github.com/tspascoal/dependabot-alerts-helper

scripts/generate-users-from-team.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Generate list of users from team
4+
35
# Usage: ./generate-users-from-team.sh <org> <team> > users.csv
46

57
if [ $# -ne "2" ]; then

scripts/get-app-jwt.py

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env python3
2+
3+
# This script generates a JWT for a GitHub App
4+
25
import jwt # pip3 install jwt
36
import time
47
import sys

scripts/get-app-tokens-for-each-installation.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Get app tokens for each organization installation of a GitHub app
4+
35
# example usage: `./get-app-tokens-for-each-installation.sh 314893 ./test-for-jwt-app-auth.2023-04-06.private-key.pem`
46

57
if [ -z "$2" ]; then

scripts/get-new-outside-collaborators-added-to-repository.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Get new outside collaborators added to a repository since the last time this script was run
4+
35
# Usage:
46
# Step 1: ./new-users-to-add-to-project.sh <org> <repo> <file>
57
# Step 2: Don't delete the `<file>` as it functions as your user database

scripts/remove-users-from-org.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/bash
2-
# DOT NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
2+
3+
# Remove users from an organization from a CSV input list
34

45
# Usage:
56
# Step 1: Create a list of users in a csv file, 1 per line, with a trailing empty line at the end of the file (or use ./generate-users-from-team <org> <team>)
7+
# - DO NOT REMOVE TRAILING NEW LINE IN THE INPUT CSV FILE
68
# Step 2: ./remove-users-from-org.sh <file> <org>
79

810
if [ $# -ne "2" ]; then

scripts/verify-team-membership.sh

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
# Verify if a specified user is a member of a team
4+
35
members=$(gh api --paginate /orgs/joshjohanning-org/teams/approver-team/members --jq='.[] | [.login] | join(",")')
46

57
themember="joshjohanning"

0 commit comments

Comments
 (0)