forked from ahmadawais/action-auto-changelog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
40 lines (32 loc) · 1.04 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
#!/bin/sh -l
set -e
INPUT_BRANCH=${INPUT_BRANCH:-main}
INPUT_FORCE=${INPUT_FORCE:-false}
INPUT_TAGS=${INPUT_TAGS:-false}
INPUT_DIRECTORY=${INPUT_DIRECTORY:-'.'}
_FORCE_OPTION=''
REPOSITORY=${INPUT_REPOSITORY:-$GITHUB_REPOSITORY}
git config --global user.email "nicolas@eoxia.com"
git config --global user.name "Nicolas Domenech"
git config --global --add safe.directory /github/workspace
echo "❯ Generate changelog:";
npx auto-changelog --package --unreleased --output 'changelog.md' --commit-limit 'false'
echo "❯ Git commit:";
git add .
git commit -m " 📖 Changelog"
echo "❯ Configure:";
[ -z "${INPUT_GITHUB_TOKEN}" ] && {
echo 'Missing input "github_token: ${{ secrets.GITHUB_TOKEN }}".';
exit 1;
};
if ${INPUT_FORCE}; then
_FORCE_OPTION='--force'
fi
if ${TAGS}; then
_TAGS='--tags'
fi
cd ${INPUT_DIRECTORY}
remote_repo="https://${GITHUB_ACTOR}:${INPUT_GITHUB_TOKEN}@github.com/${REPOSITORY}.git"
echo "❯ Git push:";
git push "${remote_repo}" HEAD:${INPUT_BRANCH} --follow-tags $_FORCE_OPTION $_TAGS;
echo "❯❯ All done!";