-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathentrypoint.sh
34 lines (26 loc) · 924 Bytes
/
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
#!/bin/bash
# Fail on error
set -eu -o pipefail
# Debug
echo "Running git subtree ${INPUT_ACTION} on ${INPUT_REPO} at ${INPUT_POSITION} with prefix ${INPUT_PREFIX}"
# Args
SQUASH=""
if [ "${INPUT_SQUASH}" == "true" ]; then
SQUASH="--squash"
fi
# Fix dubious ownership
git config --global --add safe.directory /github/workspace
# Set git email and name
git config --global user.email "${INPUT_GIT_EMAIL}"
git config --global user.name "${INPUT_GIT_NAME}"
# Make sure there are no prompts for git commands
cp .git/config .git/config-original
git config --global url."https://api:${INPUT_PAT}@github.com/".insteadOf "https://github.com/"
git config --unset http."https://github.com/".extraheader
# Update subtree
git subtree ${INPUT_ACTION} -d \
--prefix=${INPUT_PREFIX} "${INPUT_REPO}" "${INPUT_POSITION}" \
--message="${INPUT_MESSAGE}" \
$SQUASH
# Revert git config change
cp -f .git/config-original .git/config