Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Boilerplate Code for Welcome Bot #932

Merged
merged 1 commit into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/config.yml
Original file line number Diff line number Diff line change
@@ -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! 🛠
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
export REPOSITORY=flyteidl

define PIP_COMPILE
pip-compile $(1) --upgrade --verbose
endef

.PHONY: update_boilerplate
update_boilerplate:
@boilerplate/update.sh

.PHONY: kustomize
kustomize:
KUSTOMIZE_VERSION=3.9.2 bash script/generate_kustomize.sh
Expand Down
8 changes: 8 additions & 0 deletions boilerplate/flyte/Readme.rst
Original file line number Diff line number Diff line change
@@ -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.
15 changes: 15 additions & 0 deletions boilerplate/flyte/config.yml
Original file line number Diff line number Diff line change
@@ -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! 🛠
14 changes: 14 additions & 0 deletions boilerplate/flyte/update.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions boilerplate/update.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flyte/
75 changes: 75 additions & 0 deletions boilerplate/update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/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 )"

OUT="$(mktemp -d)"
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"
echo ""


CONFIG_FILE="${DIR}/update.cfg"
README="https://github.com/flyteorg/boilerplate/blob/master/Readme.rst"

if [ ! -f "$CONFIG_FILE" ]; then
echo "$CONFIG_FILE not found."
echo "This file is required in order to select which features to include."
echo "See $README for more details."
exit 1
fi

if [ -z "$REPOSITORY" ]; then
echo '$REPOSITORY is required to run this script'
echo "See $README for more details."
exit 1
fi

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."
rm -rf "${DIR}/${directory}"
mkdir -p $(dirname "${DIR}/${directory}")
cp -r "$dir_path" "${DIR}/${directory}"
if [ -f "${DIR}/${directory}/update.sh" ]; then
echo "executing ${DIR}/${directory}/update.sh"
"${DIR}/${directory}/update.sh"
fi
echo "***********************************************************************************"
echo ""
done < "$CONFIG_FILE"