Utility scripts to perform common, repetitive tasks
- To generate an access token for Firebase cloud messaging
groovy GoogleAccessToken.groovy -c "path/to/service-accounts.json" -s "https://www.googleapis.com/auth/firebase.messaging"
When using these scripts with github enterprise, an API URL including the /api/v3
path would need to be supplied
Adds a supplied label to issues with a specific string in title
- To use with a repo in an org
groovy github/AddLabelToIssues.groovy -t <GIT_TOKEN> -n <username> -o <org> -r <repo-name> \
-s <search-string> -l <label>
- To use with a repo under a username
groovy github/AddLabelToIssues.groovy -t <GIT_TOKEN> -n <username> -r <repo-name> -s <search-string> -l <label>
Closes issues that have a specific label
- To use with a repo in an org
groovy github/CloseIssues.groovy -t <GIT_TOKEN> -n <username> -o <org> -r <repo-name> -l <label>
- To use with a repo under a username
groovy github/CloseIssues.groovy -t <GIT_TOKEN> -n <username> -r <repo-name> -l <label>
Creates a git tag with commit comments as message and pushes to remote. Needs to be executed with the git repo as the working directory
Sample:
groovy /absolute/path/to/utilities/scripts/Groovy/github/CreateTag.groovy
Parameters:
--help Displays script usage instructions
-nd,--not-dry-run Flag to test changes without committing to git
- To encode a string
groovy Base64.groovy -i hello
- To encode contents of a file
groovy Base64.groovy -f /path/to/file
- To decode a string
groovy Base64.groovy -D -i aGVsbG8=
groovy file/Deduplicater.groovy -i /path/to/input/file -o /path/to/output/file
Queries a CSV file and outputs the results to console or to a file
Sample:
groovy CsvQuery.groovy -i /path/to/input.csv -q /path/to/query.yml -o /path/to/output.csv
Parameters:
-i,--input <input> Input CSV file
-o,--output <output> Output CSV file
-q,--query <query> Yaml file containing the query
-t,--threads <threads> Number of threads to use for processing
query.yml sample:
select:
- full_name
- birthday
- age
- country
reductions:
- distinct
transformations:
- name: concat
fields:
- full_name
parameters:
right: ';'
- name: convert_date
fields:
- birthday
parameters:
input_format: MM/dd/yyyy
output_format: yyyy-MM-dd
where:
operator: and
filters:
- operator: or
filters:
- field: first_name
condition: in
values:
- John
- Jack
- field: last_name
condition: in
values:
- Smith
- field: last_name
condition: nin
values:
- Snow
- field: country
condition: like
values:
- ^Canada$|^Mexico$
Backs up specific files/folders within a source folder into a target folder. Files/folders to be backed up need to be specified in a config file
Sample:
groovy BackupCreator.groovy -s /path/to/source -t /path/to/target -c backup-config.yml
Parameters:
-c,--config <config> File containing the config to use for the backup
-l,--log-level <log-level> Log level to use. Defaults to INFO
-s,--source-path <source-path> Path from which to backup the files
-t,--target-path <target-path> Path to which to backup the files
Config file sample:
inclusions:
- .gradle/gradle.properties
- .circleci/cli.yml
- .docker/config.json
- .jenkins/init.groovy.d
- .jenkins/secrets
- .kube/config
- .minikube/ca.crt
- .minikube/certs
- .minikube/config
- .minikube/machines
- .minikube/profiles
- .ssh
- .gitconfig
- .bashrc
- .bash_history
- .dbshell
- .netrc
- .zshrc