Changeset View
Changeset View
Standalone View
Standalone View
contrib/source-control-tools/automated-commits.sh
#!/usr/bin/env bash | #!/usr/bin/env bash | ||||
# Note: Any bot running this script must have the appropriate permissions to | # Note: Any bot running this script must have the appropriate permissions to | ||||
# push commits upstream. When running locally, this script will git push in a | # push commits upstream. When running locally, this script will git push in a | ||||
# dry run by default. | # dry run by default. | ||||
export LC_ALL=C.UTF-8 | export LC_ALL=C.UTF-8 | ||||
set -euxo pipefail | set -euxo pipefail | ||||
DEFAULT_PARENT_COMMIT="origin/master" | DEFAULT_PARENT_COMMIT="origin/master" | ||||
help_message() { | help_message() { | ||||
set +x | cat <<EOF | ||||
echo "Generate a commit from available recipes." | Generate a commit from available recipes. | ||||
echo | |||||
echo "Options:" | Options: | ||||
echo "-p, --parent The parent commit to build ontop of. Default: '${DEFAULT_PARENT_COMMIT}'" | -p, --parent The parent commit to build ontop of. Default: '${DEFAULT_PARENT_COMMIT}' | ||||
echo " Note: This should only be used for testing since the behavior of setting" | Note: This should only be used for testing since the behavior of setting | ||||
echo " this to a particular commit varies slightly from the default." | this to a particular commit varies slightly from the default. | ||||
echo "-h, --help Display this help message." | -h, --help Display this help message. | ||||
echo | |||||
echo "Environment Variables:" | Environment Variables: | ||||
echo "COMMIT_TYPE (required) The commit recipe to run." | COMMIT_TYPE (required) The commit recipe to run. | ||||
echo "DRY_RUN If set to 'no', this script will push the generated changes upstream. Default: 'yes'" | DRY_RUN If set to 'no', this script will push the generated changes upstream. Default: 'yes' | ||||
set -x | EOF | ||||
} | } | ||||
PARENT_COMMIT="${DEFAULT_PARENT_COMMIT}" | PARENT_COMMIT="${DEFAULT_PARENT_COMMIT}" | ||||
# Parse command line arguments | # Parse command line arguments | ||||
while [[ $# -gt 0 ]]; do | while [[ $# -gt 0 ]]; do | ||||
case $1 in | case $1 in | ||||
-p|--parent) | -p|--parent) | ||||
▲ Show 20 Lines • Show All 207 Lines • Show Last 20 Lines |