-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
44 lines (37 loc) · 1.32 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
41
42
43
44
#!/bin/sh
set -eu
DOCS_REPO_NAME="${INPUT_REPO_NAME}"
DOCS_CHANGE_LOG_FILE="${INPUT_REMOTE_FILE}"
DOCS_LOCAL_CHANGE_LOG_FILE="${INPUT_LOCAL_FILE}"
GITHUB_TOKEN="${INPUT_GITHUB_TOKEN}"
DOCS_REPO_LINK="https://x-access-token:$GITHUB_TOKEN@github.com/${DOCS_REPO_NAME}"
echo "
------------------------------------------------
Repo Name : ${DOCS_REPO_NAME}
Repo Link : ${DOCS_REPO_LINK}
Remote File : ${DOCS_CHANGE_LOG_FILE}
Local File : ${DOCS_LOCAL_CHANGE_LOG_FILE}
------------------------------------------------
"
echo "🔧 Setting Up"
cd ../../
mkdir docs_repo
cd docs_repo
echo "##[group]🌐 Clone Documentation Github Repository"
git clone $DOCS_REPO_LINK ./
echo "##[endgroup]"
echo "🔀 Copying Change Log File"
rm -rf $DOCS_CHANGE_LOG_FILE
cp $GITHUB_WORKSPACE/$DOCS_LOCAL_CHANGE_LOG_FILE ./$DOCS_CHANGE_LOG_FILE
if [ -z "$(git status --porcelain)" ]; then
echo "✅ Nothing To Push"
else
echo "##[group] 👌 Updating ${DOCS_REPO_NAME}"
git config --global user.email "githubactionbot+changelog@gmail.com" && git config --global user.name "Change Log Updater Github Bot"
git add -A
git commit -m "👌 Change Log Updated / ⚡ Triggered By $GITHUB_REPOSITORY@$GITHUB_SHA"
#git push "https://x-access-token:$GITHUB_TOKEN@${DOCS_REPO_LINK}"
git push ${DOCS_REPO_LINK}
echo "##[endgroup]
👌 Update Complete"
fi