-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·43 lines (33 loc) · 1.36 KB
/
run.sh
File metadata and controls
executable file
·43 lines (33 loc) · 1.36 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
#!/usr/bin/env bash
set -euo pipefail
# Isolate nested Git commands from caller-specific repository environment such as hooks.
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_PREFIX GIT_INTERNAL_SUPER_PREFIX GIT_COMMON_DIR
target="${INPUT_TARGET:-.github/wiki}"
publish_branch="${INPUT_PUBLISH_BRANCH:-master}"
commit_message="${INPUT_COMMIT_MESSAGE:-Refresh wiki docs after merged release}"
git -C "${target}" fetch origin "${publish_branch}"
git -C "${target}" reset --hard HEAD
git -C "${target}" clean -fd
dev-tools wiki --target="${target}"
if [ -z "$(git -C "${target}" status --porcelain)" ]; then
{
echo "published=false"
echo "pointer-changed=false"
echo "publish-sha=$(git -C "${target}" rev-parse HEAD)"
} >> "${GITHUB_OUTPUT}"
exit 0
fi
git -C "${target}" config user.name "${GIT_AUTHOR_NAME:-github-actions[bot]}"
git -C "${target}" config user.email "${GIT_AUTHOR_EMAIL:-41898282+github-actions[bot]@users.noreply.github.com}"
git -C "${target}" add -A
git -C "${target}" commit -m "${commit_message}"
git -C "${target}" push --force-with-lease origin "HEAD:${publish_branch}"
pointer_changed="false"
if ! git diff --quiet -- "${target}"; then
pointer_changed="true"
fi
{
echo "published=true"
echo "pointer-changed=${pointer_changed}"
echo "publish-sha=$(git -C "${target}" rev-parse HEAD)"
} >> "${GITHUB_OUTPUT}"