Skip to content

Commit afc6323

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

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

action.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,19 @@ 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+
print_info "setup with GITHUB_REPOSITORY"
42+
export GITHUB_ORIGIN=${GITHUB_REPOSITORY}
43+
fi
44+
3845
if [ -n "${GITHUB_TOKEN}" ]; then
3946
print_info "setup with GITHUB_TOKEN"
40-
remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git"
47+
remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_ORIGIN}.git"
4148
elif [ -n "${PERSONAL_TOKEN}" ]; then
4249
print_info "setup with PERSONAL_TOKEN"
43-
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git"
50+
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_ORIGIN}.git"
4451
else
4552
print_info "no token found; linting"
4653
exec -- mkdocs build --config-file "${CONFIG_FILE}"

0 commit comments

Comments
 (0)