Limitation using GITHUB_TOKEN

This commit is contained in:
CrazyMax 2019-09-01 07:01:38 +02:00
parent eea3bd5a83
commit 0e95a6165e
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 18 additions and 2 deletions

View File

@ -65,11 +65,27 @@ Following inputs can be used as `step.with` keys
### environment variables ### environment variables
The following are *required* as `step.env` keys Following environment variables can be used as `step.env` keys
| Name | Description | | Name | Description |
|----------------|--------------------------------------| |----------------|--------------------------------------|
| `GITHUB_TOKEN` | GITHUB_TOKEN as provided by `secrets`| | `GITHUB_TOKEN` | GITHUB_TOKEN as provided by `secrets`|
| `GITHUB_PAT` | [Personal Access Token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) (see Limitation section below)|
## :warning: Limitation
Currently, `GITHUB_TOKEN` does not suffice to trigger a page build on a **public repository** (propagate content to the GitHub content-delivery network). You must therefore create a custom [Personal Access Token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) and use it through the `GITHUB_PAT` environment variable:
```yaml
- name: Deploy
if: success()
uses: crazy-max/ghaction-github-pages@master
with:
target_branch: gh-pages
build_dir: public
env:
GITHUB_PAT: ${{ secrets.GITHUB_PAT }}
```
## 🤝 How can I help ? ## 🤝 How can I help ?

View File

@ -21,7 +21,7 @@ git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add . git add .
git commit --allow-empty -m 'Deploy to GitHub pages' git commit --allow-empty -m 'Deploy to GitHub pages'
git push --force --quiet "https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "master:$TARGET_BRANCH" git push --force --quiet https://${GITHUB_PAT:-"x-access-token:$GITHUB_TOKEN"}@github.com/${GITHUB_REPOSITORY}.git master:$TARGET_BRANCH
rm -rf .git rm -rf .git
cd "$GITHUB_WORKSPACE" cd "$GITHUB_WORKSPACE"