From 7472485ed1db49099430b55fa4b27e0f9781c9fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20De=20Boey?= Date: Fri, 30 Sep 2022 23:20:08 +0200 Subject: [PATCH] chore: change `access_token` to optional (#72) --- README.md | 4 ---- action.yml | 4 ++-- src/index.ts | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6d1dc44e..f49a2a6c 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,6 @@ jobs: steps: - name: Cancel Previous Runs uses: styfle/cancel-workflow-action@0.10.0 - with: - access_token: ${{ github.token }} #- name: Run Tests # uses: actions/setup-node@v1 # run: node test.js @@ -48,7 +46,6 @@ jobs: - uses: styfle/cancel-workflow-action@0.10.0 with: workflow_id: 479426 - access_token: ${{ github.token }} ``` - _Note_: `workflow_id` can be a Workflow ID (number) or Workflow File Name (string) @@ -119,7 +116,6 @@ jobs: - uses: styfle/cancel-workflow-action@0.10.0 with: all_but_latest: true - access_token: ${{ github.token }} ``` ### Advanced: Token Permissions diff --git a/action.yml b/action.yml index db1ff02a..ed80ff53 100644 --- a/action.yml +++ b/action.yml @@ -14,8 +14,8 @@ inputs: default: 'false' access_token: description: 'Your GitHub Access Token, defaults to: {{ github.token }}' - default: '${{ github.token }}' - required: true + default: ${{ github.token }} + required: false all_but_latest: description: "Cancel all actions but the last one" required: false diff --git a/src/index.ts b/src/index.ts index 873db535..93d04dbc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -30,7 +30,7 @@ async function main() { } console.log({ eventName, sha, headSha, branch, owner, repo, GITHUB_RUN_ID }); - const token = core.getInput('access_token', { required: true }); + const token = core.getInput('access_token'); const workflow_id = core.getInput('workflow_id', { required: false }); const ignore_sha = core.getBooleanInput('ignore_sha', { required: false }); const all_but_latest = core.getBooleanInput('all_but_latest', { required: false });