From 9945cf63fa0480414684e0be4456d530975a6f5e Mon Sep 17 00:00:00 2001 From: marocchino Date: Mon, 22 Mar 2021 06:32:32 +0900 Subject: [PATCH] docs: omit github token in docs --- .github/workflows/comment_on_pull_request.yml | 1 - .github/workflows/comment_on_push.yml | 3 - README.md | 83 +++++++++---------- action.yml | 1 + 4 files changed, 38 insertions(+), 50 deletions(-) diff --git a/.github/workflows/comment_on_pull_request.yml b/.github/workflows/comment_on_pull_request.yml index 36817d1..1ace6ad 100644 --- a/.github/workflows/comment_on_pull_request.yml +++ b/.github/workflows/comment_on_pull_request.yml @@ -9,7 +9,6 @@ jobs: - uses: actions/checkout@v2 - uses: ./ with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} header: FromPR message: | Test ${{ github.sha }} is successfully ended. diff --git a/.github/workflows/comment_on_push.yml b/.github/workflows/comment_on_push.yml index 5ee7265..6105fc5 100644 --- a/.github/workflows/comment_on_push.yml +++ b/.github/workflows/comment_on_push.yml @@ -9,11 +9,8 @@ jobs: - uses: actions/checkout@v2 - uses: jwalton/gh-find-current-pr@v1 id: finder - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - uses: ./ with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} number: ${{ steps.finder.outputs.pr }} message: | Test ${{ github.sha }} is successfully ended. diff --git a/README.md b/README.md index e2a93a5..d6ec922 100644 --- a/README.md +++ b/README.md @@ -22,30 +22,28 @@ In some cases, different actions may require different comments. The header allo release: ... - uses: marocchino/sticky-pull-request-comment@v2 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: release - message: | - Release ${{ github.sha }} to + with: + header: release + message: | + Release ${{ github.sha }} to test: ... - name: Run Test - id: test - run: | - OUTPUT=$(rake test) - OUTPUT="${OUTPUT//'%'/'%25'}​【7,6 m】" - OUTPUT="${OUTPUT//$'\n'/'%0A'}" - OUTPUT="${OUTPUT//$'\r'/'%0D'}" - echo "::set-output name=result::$OUTPUT" + id: test + run: | + OUTPUT=$(rake test) + OUTPUT="${OUTPUT//'%'/'%25'}​【7,6 m】" + OUTPUT="${OUTPUT//$'\n'/'%0A'}" + OUTPUT="${OUTPUT//$'\r'/'%0D'}" + echo "::set-output name=result::$OUTPUT" - uses: marocchino/sticky-pull-request-comment@v2 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - header: test - message: | - ``` - ${{ steps.test.outputs.result }} - ``` + with: + header: test + message: | + ``` + ${{ steps.test.outputs.result }} + ``` ``` ### Append after comment every time it runs @@ -54,22 +52,21 @@ test: test: ... - name: Run Test - id: test - run: | - OUTPUT=$(rake test) - OUTPUT="${OUTPUT//'%'/'%25'}​【7,6 m】" - OUTPUT="${OUTPUT//$'\n'/'%0A'}" - OUTPUT="${OUTPUT//$'\r'/'%0D'}" - echo "::set-output name=result::$OUTPUT" + id: test + run: | + OUTPUT=$(rake test) + OUTPUT="${OUTPUT//'%'/'%25'}​【7,6 m】" + OUTPUT="${OUTPUT//$'\n'/'%0A'}" + OUTPUT="${OUTPUT//$'\r'/'%0D'}" + echo "::set-output name=result::$OUTPUT" - uses: marocchino/sticky-pull-request-comment@v2 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - append: true - message: | - Test with ${{ github.sha }}. - ``` - ${{ steps.test.outputs.result }} - ``` + with: + append: true + message: | + Test with ${{ github.sha }}. + ``` + ${{ steps.test.outputs.result }} + ``` ``` ### Comment from push @@ -78,16 +75,13 @@ If for some reason, triggering on pr is not possible, you can use push. ```yaml - uses: jwalton/gh-find-current-pr@v1 -id: finder -with: - github-token: ${{ secrets.GITHUB_TOKEN }} + id: finder - uses: marocchino/sticky-pull-request-comment@v2 -with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - number: ${{ steps.finder.outputs.pr }} - message: | - Test ${{ github.sha }} is successfully ended. - This is message from push. + with: + number: ${{ steps.finder.outputs.pr }} + message: | + Test ${{ github.sha }} is successfully ended. + This is message from push. ``` ### Read comment from a file @@ -95,7 +89,6 @@ with: ```yaml uses: marocchino/sticky-pull-request-comment@v2 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} path: path-to-comment-contents.txt ``` @@ -104,7 +97,6 @@ with: ```yaml uses: marocchino/sticky-pull-request-comment@v2 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} recreate: true message: | Release ${{ github.sha }} to @@ -115,7 +107,6 @@ with: ```yaml uses: marocchino/sticky-pull-request-comment@v2 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} delete: true ``` diff --git a/action.yml b/action.yml index ac08a5e..5563b06 100644 --- a/action.yml +++ b/action.yml @@ -29,6 +29,7 @@ inputs: GITHUB_TOKEN: description: 'The GitHub access token (e.g. secrets.GITHUB_TOKEN) used to create or update the comment. This defaults to {{ github.token }}.' default: '${{ github.token }}' + required: false runs: using: "node12" main: "dist/index.js"