forked from wandb/wandb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
65 lines (54 loc) · 1.74 KB
/
entrypoint.sh
File metadata and controls
65 lines (54 loc) · 1.74 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/sh
set -eu
# Set up .netrc file with GitHub credentials
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 config --global user.email "actions@github.com"
git config --global user.name "Add & Commit GitHub Action"
}
add() {
if $INPUT_FORCE
then find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add -f $x; done
else find $INPUT_PATH -name "$INPUT_PATTERN" | while read x; do git add $x; done
fi
}
# This is needed to make the check work for untracked files
echo "Staging files in commit path..."
git_setup
git clone $INPUT_REPO doc_repo
cd doc_repo
mkdir -p library/reference
rm -rf library/reference/*
cp ../generated_docs/* library/reference/
# One off removal
rm library/reference/README.md
rm library/reference/cli.md
git add library/reference/*
#add
echo "Checking for uncommitted changes in the git working tree..."
# This section only runs if there have been file changes
if ! git diff --cached --exit-code
then
# Switch to branch from current Workflow run
#echo "Creating and switching branch..."
#git branch "${GITHUB_REF:11}"
#git checkout "${GITHUB_REF:11}"
#git status
echo "Status was called"
git commit -m "Docs updated" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
git push --set-upstream origin master
#echo "Creating commit..."
#git commit -m "$INPUT_MESSAGE" --author="$INPUT_AUTHOR_NAME <$INPUT_AUTHOR_EMAIL>"
#echo "Pushing to repo..."
#git push --set-upstream origin "${GITHUB_REF:11}"
else
echo "Working tree clean. Nothing to commit."
fi