This repository was archived by the owner on Feb 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
65 lines (47 loc) · 1.47 KB
/
entrypoint.sh
File metadata and controls
65 lines (47 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash -l
set -e
if [[ -z "$GITHUB_TOKEN" ]]; then
echo "Required the GITHUB_TOKEN environment variable."
exit 1
fi
if [[ -z "$GIT_USER_NAME" ]]; then
echo "require to set with: GIT_USER_NAME."
exit 1
fi
if [[ -z "$GIT_EMAIL" ]]; then
echo "require to set with: GIT_EMAIL."
exit 1
fi
git remote set-url origin "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY"
git checkout master
BRANCH_NAME="bundle_update/$(date "+%Y%m%d_%H%M%S")"
git checkout -b ${BRANCH_NAME}
export PATH="/usr/local/bundle/bin:$PATH"
if [[ -n "$INPUT_BUNDLER_VERSION" ]]; then
gem install bundler -v "$INPUT_BUNDLER_VERSION"
else
gem install bundler
fi
gem install bundler-diff
bundle config --local build.mysql2 "--with-ldflags=-L/usr/local/opt/openssl/lib"
bundle update
bundle diff -f md_table
BUNDLE_DIFF="$(bundle diff -f md_table)"
if [ "$(git diff --name-only origin/master --diff-filter=d | wc -w)" == 0 ]; then
echo "not update"
exit 1
fi
export GITHUB_USER="$GITHUB_ACTOR"
git config --global user.name $GIT_USER_NAME
git config --global user.email $GIT_EMAIL
hub add Gemfile Gemfile.lock
hub commit -m "bundle update && bundle update --ruby"
hub push origin ${BRANCH_NAME}
TITLE="bundle update $(date "+%Y%m%d_%H%M%S")"
PR_ARG="-m \"$TITLE\" -m \"$BUNDLE_DIFF\""
if [[ -n "$INPUT_REVIEWERS" ]]; then
PR_ARG="$PR_ARG -r \"$INPUT_REVIEWERS\""
fi
COMMAND="hub pull-request -b master -h $BRANCH_NAME --no-edit $PR_ARG || true"
echo "$COMMAND"
sh -c "$COMMAND"