Skip to content

Commit 196f8ba

Browse files
committed
Add GitHub token as default (#1)
Signed-off-by: RammusXu <comte_ken@hotmail.com>
1 parent 726f9fe commit 196f8ba

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Note that this is an account-level token that has access to update **any** repo
1616

1717
### Building with `GITHUB_TOKEN`
1818

19-
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.
19+
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.
2020

2121
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.
2222

@@ -57,8 +57,9 @@ jobs:
5757
uses: mhausenblas/mkdocs-deploy-gh-pages@master
5858
# Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme
5959
env:
60-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6160
CUSTOM_DOMAIN: optionaldomain.com
6261
CONFIG_FILE: folder/mkdocs.yml
6362
EXTRA_PACKAGES: build-base
63+
with:
64+
auth_token: ${{ secret.PERSONAL_TOKEN }} # Optional
6465
```

action.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ else
3131
export CONFIG_FILE="${GITHUB_WORKSPACE}/mkdocs.yml"
3232
fi
3333

34-
if [ -n "${GITHUB_TOKEN}" ]; then
35-
print_info "setup with GITHUB_TOKEN"
34+
if [ -n "${INPUT_AUTH_TOKEN}" ]; then
35+
print_info "setup with INPUT_AUTH_TOKEN"
3636
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
3737
elif [ -n "${PERSONAL_TOKEN}" ]; then
3838
print_info "setup with PERSONAL_TOKEN"

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
name: 'Deploy MkDocs'
33
description: 'Deploys MkDocs site'
44
author: 'Michael Hausenblas, hausenb@amazon.com'
5+
inputs:
6+
auth_token:
7+
description: 'Auth token used to API'
8+
required: false
9+
default: "${{ github.token }}
510
branding:
611
icon: 'arrow-up-circle'
712
color: 'orange'

0 commit comments

Comments
 (0)