diff --git a/README.md b/README.md index ec8a65739..ad0d37411 100644 --- a/README.md +++ b/README.md @@ -25,15 +25,9 @@ The next example step will deploy `./public` directory to the remote `gh-pages` - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public ``` -For newbies of GitHub Actions: -Note that the `GITHUB_TOKEN` is **NOT** a personal access token. -A GitHub Actions runner automatically creates a `GITHUB_TOKEN` secret to authenticate in your workflow. -So, you can start to deploy immediately without any configuration. - ## Supported Tokens @@ -164,7 +158,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public ``` @@ -182,9 +175,10 @@ jobs: ### ⭐️ Set Runner's Access Token `github_token` -**This option is for `GITHUB_TOKEN`, not a personal access token.** - -A GitHub Actions runner automatically creates a `GITHUB_TOKEN` secret to use in your workflow. You can use the `GITHUB_TOKEN` to authenticate in a workflow run. +For newbies of GitHub Actions: +Note that this option is for `GITHUB_TOKEN`, **NOT** a personal access token. +A GitHub Actions runner automatically creates a `GITHUB_TOKEN` secret to authenticate in your workflow. +So, you can start to deploy immediately without any configuration. ```yaml - name: Deploy @@ -194,7 +188,7 @@ A GitHub Actions runner automatically creates a `GITHUB_TOKEN` secret to use in publish_dir: ./public ``` -For more details about `GITHUB_TOKEN`: [Authenticating with the GITHUB_TOKEN - GitHub Help](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) +For more details about `GITHUB_TOKEN`: [Authenticating with the GITHUB_TOKEN - GitHub Help](https://docs.github.com/en/actions/reference/authentication-in-a-workflow) ### ⭐️ Set SSH Private Key `deploy_key` @@ -229,7 +223,6 @@ The default is `gh-pages`. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_branch: your-branch # default: gh-pages ``` @@ -241,7 +234,6 @@ A source directory to deploy to GitHub Pages. The default is `public`. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./out # default: public ``` @@ -256,7 +248,6 @@ A destination subdirectory on a publishing branch. The default is empty. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} destination_dir: subdir ``` @@ -273,7 +264,6 @@ Values should be split with a comma. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} exclude_assets: '.github,exclude-file1,exclude-file2' ``` @@ -283,9 +273,6 @@ Set `exclude_assets` to empty for including the `.github` directory to deploymen - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} # Recommended for this usage - # personal_token: ${{ secrets.PERSONAL_TOKEN }} # An alternative - # github_token: ${{ secrets.GITHUB_TOKEN }} # This does not work for this usage exclude_assets: '' ``` @@ -295,7 +282,6 @@ The `exclude_assets` option supports glob patterns. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} exclude_assets: '.github,exclude-file.txt,exclude-dir/**.txt' ``` @@ -310,7 +296,6 @@ For more details about the `CNAME` file, read the official documentation: [Manag - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public cname: github.com ``` @@ -330,7 +315,6 @@ Bypassing Jekyll makes the deployment faster and is necessary if you are deployi - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public enable_jekyll: true ``` @@ -347,7 +331,6 @@ For example: - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public allow_empty_commit: true ``` @@ -367,7 +350,6 @@ For example: - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public keep_files: true ``` @@ -413,7 +395,6 @@ This allows you to make your publish branch with only the latest commit. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public force_orphan: true ``` @@ -427,7 +408,6 @@ A commit is always created with the same user. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public user_name: 'github-actions[bot]' user_email: 'github-actions[bot]@users.noreply.github.com' @@ -444,7 +424,6 @@ When we create a commit with a message `docs: Update some post`, a deployment co - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public commit_message: ${{ github.event.head_commit.message }} ``` @@ -458,7 +437,6 @@ use the `full_commit_message` option instead of the `commit_message` option. - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public full_commit_message: ${{ github.event.head_commit.message }} ``` @@ -498,7 +476,6 @@ jobs: - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public tag_name: ${{ steps.prepare_tag.outputs.deploy_tag_name }} tag_message: 'Deployment ${{ steps.prepare_tag.outputs.tag_name }}' @@ -674,7 +651,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public ``` @@ -724,7 +700,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public ``` @@ -779,7 +754,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./out ``` @@ -830,7 +804,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist ``` @@ -889,7 +862,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./website/build ``` @@ -951,7 +923,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./site ``` @@ -992,7 +963,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./book ``` @@ -1036,7 +1006,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./build/web ``` @@ -1085,7 +1054,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./public ``` @@ -1115,7 +1083,6 @@ jobs: - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v3 with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./ allow_empty_commit: true enable_jekyll: true @@ -1171,7 +1138,6 @@ jobs: uses: peaceiris/actions-gh-pages@v3 if: ${{ github.ref == 'refs/heads/main' }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./Output ``` diff --git a/action.yml b/action.yml index 14ad0671f..58cd2772b 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,7 @@ inputs: github_token: description: 'Set a generated GITHUB_TOKEN for pushing to the remote branch.' required: false + default: ${{ github.token }} personal_token: description: 'Set a personal access token for pushing to the remote branch.' required: false diff --git a/src/set-tokens.ts b/src/set-tokens.ts index 277e7fc0f..3a182c5ae 100644 --- a/src/set-tokens.ts +++ b/src/set-tokens.ts @@ -121,6 +121,8 @@ export async function setTokens(inps: Inputs): Promise { ); if (inps.DeployKey) { return setSSHKey(inps, publishRepo); + } else if (inps.PersonalToken) { + return setPersonalToken(inps.PersonalToken, publishRepo); } else if (inps.GithubToken) { const context = github.context; const ref = context.ref; @@ -133,8 +135,6 @@ export async function setTokens(inps: Inputs): Promise { ref, eventName ); - } else if (inps.PersonalToken) { - return setPersonalToken(inps.PersonalToken, publishRepo); } else { throw new Error('not found deploy key or tokens'); }