From 27d201c6e3b532b31eeb3ec9ce1dd481f24b335f Mon Sep 17 00:00:00 2001 From: Samhita Alla Date: Sat, 8 May 2021 05:00:25 +0530 Subject: [PATCH] update boilerplate code (#40) Signed-off-by: Samhita Alla --- .github/config.yml | 15 +++++++++++++++ boilerplate/flyte/Readme.rst | 8 ++++++++ boilerplate/flyte/config.yml | 15 +++++++++++++++ boilerplate/flyte/update.sh | 14 ++++++++++++++ boilerplate/update.cfg | 3 ++- boilerplate/update.sh | 37 ++++++++++++++++++++++++++++-------- 6 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 .github/config.yml create mode 100644 boilerplate/flyte/Readme.rst create mode 100644 boilerplate/flyte/config.yml create mode 100755 boilerplate/flyte/update.sh diff --git a/.github/config.yml b/.github/config.yml new file mode 100644 index 00000000..f99bcd78 --- /dev/null +++ b/.github/config.yml @@ -0,0 +1,15 @@ +# Comment to be posted on PRs from first-time contributors in your repository +newPRWelcomeComment: > + Thank you for opening this pull request! 🙌 + + These tips will help get your PR across the finish line: + - Most of the repos have a PR template; if not, fill it out to the best of your knowledge. + - Sign off your commits (Reference: [DCO Guide](https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md)). + +# Comment to be posted to on pull requests merged by a first time user +firstPRMergeComment: > + Congrats on merging your first pull request! 🎉 + +# Comment to be posted on first-time issues +newIssueWelcomeComment: > + Thank you for opening your first issue here! 🛠 diff --git a/boilerplate/flyte/Readme.rst b/boilerplate/flyte/Readme.rst new file mode 100644 index 00000000..ea187811 --- /dev/null +++ b/boilerplate/flyte/Readme.rst @@ -0,0 +1,8 @@ +Config File -- Welcome Bot +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Provides a ``config.yml`` file. + +**To Enable:** + +Add ``flyte/config.yml`` to your ``boilerplate/update.cfg`` file. \ No newline at end of file diff --git a/boilerplate/flyte/config.yml b/boilerplate/flyte/config.yml new file mode 100644 index 00000000..f99bcd78 --- /dev/null +++ b/boilerplate/flyte/config.yml @@ -0,0 +1,15 @@ +# Comment to be posted on PRs from first-time contributors in your repository +newPRWelcomeComment: > + Thank you for opening this pull request! 🙌 + + These tips will help get your PR across the finish line: + - Most of the repos have a PR template; if not, fill it out to the best of your knowledge. + - Sign off your commits (Reference: [DCO Guide](https://github.com/src-d/guide/blob/master/developer-community/fix-DCO.md)). + +# Comment to be posted to on pull requests merged by a first time user +firstPRMergeComment: > + Congrats on merging your first pull request! 🎉 + +# Comment to be posted on first-time issues +newIssueWelcomeComment: > + Thank you for opening your first issue here! 🛠 diff --git a/boilerplate/flyte/update.sh b/boilerplate/flyte/update.sh new file mode 100755 index 00000000..506c3221 --- /dev/null +++ b/boilerplate/flyte/update.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. +# ONLY EDIT THIS FILE FROM WITHIN THE 'LYFT/BOILERPLATE' REPOSITORY: +# +# TO OPT OUT OF UPDATES, SEE https://github.com/lyft/boilerplate/blob/master/Readme.rst + +set -e + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" + +# Clone the config.yml file +echo " - copying ${DIR}/config.yml to the root directory." +cp ${DIR}/config.yml ${DIR}/../../.github/config.yml diff --git a/boilerplate/update.cfg b/boilerplate/update.cfg index 9a7a0ea7..f9eb7cc7 100644 --- a/boilerplate/update.cfg +++ b/boilerplate/update.cfg @@ -4,4 +4,5 @@ lyft/golangci_file lyft/golang_dockerfile lyft/golang_support_tools lyft/pull_request_template -lyft/github_workflows \ No newline at end of file +lyft/github_workflows +flyte/ diff --git a/boilerplate/update.sh b/boilerplate/update.sh index a8c05705..374e4b93 100755 --- a/boilerplate/update.sh +++ b/boilerplate/update.sh @@ -10,7 +10,9 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" OUT="$(mktemp -d)" -git clone git@github.com:lyft/boilerplate.git "${OUT}" +trap "rm -fr $OUT" EXIT + +git clone git@github.com:flyteorg/boilerplate.git "${OUT}" echo "Updating the update.sh script." cp "${OUT}/boilerplate/update.sh" "${DIR}/update.sh" @@ -18,7 +20,7 @@ echo "" CONFIG_FILE="${DIR}/update.cfg" -README="https://github.com/lyft/boilerplate/blob/master/Readme.rst" +README="https://github.com/flyteorg/boilerplate/blob/master/Readme.rst" if [ ! -f "$CONFIG_FILE" ]; then echo "$CONFIG_FILE not found." @@ -33,13 +35,34 @@ if [ -z "$REPOSITORY" ]; then exit 1 fi -while read directory; do - # TODO: Skip empty lines, whitespace only lines, and comment lines +while read directory junk; do + # Skip comment lines (which can have leading whitespace) + if [[ "$directory" == '#'* ]]; then + continue + fi + # Skip blank or whitespace-only lines + if [[ "$directory" == "" ]]; then + continue + fi + # Lines like + # valid/path other_junk + # are not acceptable, unless `other_junk` is a comment + if [[ "$junk" != "" ]] && [[ "$junk" != '#'* ]]; then + echo "Invalid config! Only one directory is allowed per line. Found '$junk'" + exit 1 + fi + + dir_path="${OUT}/boilerplate/${directory}" + # Make sure the directory exists + if ! [[ -d "$dir_path" ]]; then + echo "Invalid boilerplate directory: '$directory'" + exit 1 + fi + echo "***********************************************************************************" echo "$directory is configured in update.cfg." echo "-----------------------------------------------------------------------------------" echo "syncing files from source." - dir_path="${OUT}/boilerplate/${directory}" rm -rf "${DIR}/${directory}" mkdir -p $(dirname "${DIR}/${directory}") cp -r "$dir_path" "${DIR}/${directory}" @@ -49,6 +72,4 @@ while read directory; do fi echo "***********************************************************************************" echo "" -done < "$CONFIG_FILE" - -rm -rf "${OUT}" +done < "$CONFIG_FILE" \ No newline at end of file