Skip to content

Commit

Permalink
action.sh: allow to change origin
Browse files Browse the repository at this point in the history
It's not possible to override a default environment variable
  • Loading branch information
andi34 committed Aug 30, 2024
1 parent 7d7e832 commit afc6323
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,19 @@ else
export CONFIG_FILE="${GITHUB_WORKSPACE}/mkdocs.yml"
fi

if [ -n "${GITHUB_ORIGIN}" ]; then
print_info "setup with GITHUB_ORIGIN"
else
print_info "setup with GITHUB_REPOSITORY"
export GITHUB_ORIGIN=${GITHUB_REPOSITORY}
fi

if [ -n "${GITHUB_TOKEN}" ]; then
print_info "setup with GITHUB_TOKEN"
remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git"
remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_ORIGIN}.git"
elif [ -n "${PERSONAL_TOKEN}" ]; then
print_info "setup with PERSONAL_TOKEN"
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_REPOSITORY}.git"
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-"github.com"}/${GITHUB_ORIGIN}.git"
else
print_info "no token found; linting"
exec -- mkdocs build --config-file "${CONFIG_FILE}"
Expand Down

0 comments on commit afc6323

Please sign in to comment.