Skip to content

Commit 12ad977

Browse files
authored
action.sh: allow to change origin
It's not possible to override a default environment variable
1 parent 7d7e832 commit 12ad977

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

action.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,18 @@ else
3535
export CONFIG_FILE="${GITHUB_WORKSPACE}/mkdocs.yml"
3636
fi
3737

38+
if [ -n "${GITHUB_ORIGIN}" ]; then
39+
print_info "setup with GITHUB_ORIGIN"
40+
else
41+
export CONFIG_FILE=${GITHUB_REPOSITORY}
42+
fi
43+
3844
if [ -n "${GITHUB_TOKEN}" ]; then
3945
print_info "setup with GITHUB_TOKEN"
40-
remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git"
46+
remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_ORIGIN}.git"
4147
elif [ -n "${PERSONAL_TOKEN}" ]; then
4248
print_info "setup with PERSONAL_TOKEN"
43-
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git"
49+
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_ORIGIN}.git"
4450
else
4551
print_info "no token found; linting"
4652
exec -- mkdocs build --config-file "${CONFIG_FILE}"

0 commit comments

Comments
 (0)