-
Notifications
You must be signed in to change notification settings - Fork 8
/
entrypoint.sh
executable file
·40 lines (35 loc) · 1.06 KB
/
entrypoint.sh
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
#!/bin/bash
set -e -o pipefail
set -x
# functions
git_setup() {
cat <<-EOF >"${HOME}"/.netrc
machine github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
machine api.github.com
login $GITHUB_ACTOR
password $GITHUB_TOKEN
EOF
chmod 600 "${HOME}"/.netrc
}
git_set_user() {
git config --global user.name "$GITHUB_ACTOR"
git config --global user.email "$GITHUB_EMAIL"
git config --global committer.name "$GITHUB_ACTOR"
git config --global committer.email "$GITHUB_EMAIL"
git config --global author.name "$GITHUB_ACTOR"
git config --global author.email "$GITHUB_EMAIL"
}
# config gpg
GPG_ASC_FILE="${1:-/init-data/GPG_ASC_FILE}" # /init-data/GPG_ASC_FILE use erda app deploy config; local debug can use $1.
gpg2 -v --batch --import < "${GPG_ASC_FILE}"
git config --global commit.gpgsign true
git config --global user.signingkey "$(gpg --list-secret-keys --keyid-format LONG | grep sec | cut -d' ' -f 4 | cut -d'/' -f 2)"
# config git
GITHUB_ACTOR="${GITHUB_ACTOR:-erda-bot}"
GITHUB_EMAIL="${GITHUB_EMAIL:[email protected]}"
git_setup
git_set_user
# run bot
/bot