-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathentrypoint.sh
More file actions
48 lines (39 loc) · 1.14 KB
/
entrypoint.sh
File metadata and controls
48 lines (39 loc) · 1.14 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
#!/bin/bash -l
set -e
[ -z "${INPUT_BRANCH}" ] && {
echo 'Missing input "branch: specified_branch".';
exit 1;
};
[ -z "${INPUT_GITHUB_TOKEN}" ] && {
echo 'Missing input "github_token: ${{ secrets.GITHUB_TOKEN }}".';
exit 1;
};
cd /opt/app
mix local.hex --force
OUTPUT=`MIX_ENV=gha mix lei.scan ${GITHUB_WORKSPACE})`
cd $GITHUB_WORKSPACE
INPUT_BRANCH=${INPUT_BRANCH}
INPUT_FORCE=${INPUT_FORCE:-false}
INPUT_TAGS=${INPUT_TAGS:-false}
INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'}
_FORCE_OPTION=''
REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
cd ${INPUT_DIRECTORY}
echo Printing Report:
echo $OUTPUT
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
filename="lei--$(date +'%Y-%m-%d--%H-%M-%S').json"
touch $filename
echo "${OUTPUT}" > $filename
git add $filename
git commit -m "Add changes" -a
echo "Push to branch $INPUT_BRANCH"
if ${INPUT_FORCE}; then
_FORCE_OPTION='--force'
fi
if ${INPUT_TAGS}; then
_TAGS='--tags'
fi
remote_repo="https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${REPOSITORY}.git"
git push "${remote_repo}" HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION $_TAGS;