@@ -26,11 +26,12 @@ periodics:
26
26
- name : github-token
27
27
mountPath : /etc/github
28
28
readOnly : true
29
- args :
29
+ args : &args
30
30
- |
31
+ printenv
31
32
go run ./cmd/monitoring.go --tag=$TARGET --config monitoring.yaml
32
33
git add monitor-snapshot/$TARGET
33
- if git diff --cached --exit-code; then
34
+ if git diff --exit-code --name-status ; then
34
35
echo "🤷 No changes happened."
35
36
exit 0
36
37
fi
@@ -56,7 +57,8 @@ periodics:
56
57
git checkout -b "$head_branch"
57
58
commit_msg="chore(monitor-snapshot/master): update files from upstreams"
58
59
git commit -m "$commit_msg"
59
- git push origin "$head_branch"
60
+ git remote -v
61
+ git push --set-upstream origin "$head_branch"
60
62
61
63
# create pull request
62
64
cat <<EOF > pr_body.txt
@@ -97,46 +99,7 @@ periodics:
97
99
- name : github-token
98
100
mountPath : /etc/github
99
101
readOnly : true
100
- args :
101
- - |
102
- go run ./cmd/monitoring.go --tag=$TARGET --config monitoring.yaml
103
- git add monitor-snapshot/$TARGET
104
- if git diff --cached --exit-code; then
105
- echo "🤷 No changes happened."
106
- exit 0
107
- fi
108
-
109
- git config user.email "[email protected] "
110
- git config user.name "ti-chi-bot"
111
-
112
- # install `gh` tool
113
- type -p curl >/dev/null || ( apt update && apt install curl -y)
114
- curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
115
- && chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
116
- && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
117
- && apt update \
118
- && apt install gh -y
119
-
120
- # login and setup git
121
- gh auth login --with-token < /etc/github/token
122
- gh auth setup-git
123
-
124
- # commit and push the changes.
125
- head_branch="fix/${TARGET}/update-snapshot-files"
126
- git checkout -b "$head_branch"
127
- commit_msg="chore(monitor-snapshot/master): update files from upstreams"
128
- git commit -m "$commit_msg"
129
- git push origin "$head_branch"
130
-
131
- # create pull request
132
- cat <<EOF > pr_body.txt
133
- Auto generated by bot periodics.
134
- EOF
135
- gh pr create \
136
- --base $TARGET \
137
- --head "$head_branch" \
138
- --fill \
139
- --body-file pr_body.txt
102
+ args : *args
140
103
volumes :
141
104
- name : github-token
142
105
secret :
0 commit comments