Skip to content

Commit

Permalink
Add GitHub token as default (#1)
Browse files Browse the repository at this point in the history
Signed-off-by: RammusXu <[email protected]>
  • Loading branch information
RammusXu committed Jan 28, 2021
1 parent 726f9fe commit 196f8ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Note that this is an account-level token that has access to update **any** repo

### Building with `GITHUB_TOKEN`

This action supports building and deploying with a `GITHUB_TOKEN`. This token is automatically generated by Github Actions when a workflow runs so it is convenient.
This action supports building and deploying with a `GITHUB_TOKEN` as default. This token is automatically generated by Github Actions when a workflow runs so it is convenient.

It is more **secure** than a personal token, since you never actually see the value of the `GITHUB_TOKEN` and also the `GITHUB_TOKEN` is scoped to only work for a **single** repo.

Expand Down Expand Up @@ -57,8 +57,9 @@ jobs:
uses: mhausenblas/mkdocs-deploy-gh-pages@master
# Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CUSTOM_DOMAIN: optionaldomain.com
CONFIG_FILE: folder/mkdocs.yml
EXTRA_PACKAGES: build-base
with:
auth_token: ${{ secret.PERSONAL_TOKEN }} # Optional
```
4 changes: 2 additions & 2 deletions action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ else
export CONFIG_FILE="${GITHUB_WORKSPACE}/mkdocs.yml"
fi

if [ -n "${GITHUB_TOKEN}" ]; then
print_info "setup with GITHUB_TOKEN"
if [ -n "${INPUT_AUTH_TOKEN}" ]; then
print_info "setup with INPUT_AUTH_TOKEN"
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
elif [ -n "${PERSONAL_TOKEN}" ]; then
print_info "setup with PERSONAL_TOKEN"
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
name: 'Deploy MkDocs'
description: 'Deploys MkDocs site'
author: 'Michael Hausenblas, [email protected]'
inputs:
auth_token:
description: 'Auth token used to API'
required: false
default: "${{ github.token }}
branding:
icon: 'arrow-up-circle'
color: 'orange'
Expand Down

0 comments on commit 196f8ba

Please sign in to comment.