-
-
Notifications
You must be signed in to change notification settings - Fork 238
/
Copy pathentrypoint.sh
executable file
·46 lines (36 loc) · 1.1 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
45
46
#!/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 "[email protected]"
git config --global user.name "GitHub Actions"
}
# This section only runs if there have been file changes
echo "Checking for uncommitted changes in the git working tree."
if ! git diff --quiet
then
git_setup
echo "INPUT_BRANCH value: $INPUT_BRANCH";
# Switch to branch from current Workflow run
git checkout $INPUT_BRANCH
if [ -z ${INPUT_FILE_PATTERN+x} ];
then
git add .
else
echo "INPUT_FILE_PATTERN value: $INPUT_FILE_PATTERN";
git add $INPUT_FILE_PATTERN
fi
git commit -m "$INPUT_COMMIT_MESSAGE" --author="$GITHUB_ACTOR <[email protected]>"
git push --set-upstream origin "HEAD:$INPUT_BRANCH"
else
echo "Working tree clean. Nothing to commit."
fi