From 36ec3bdeddc072dd1fe1e25a893e8c63a41b2d72 Mon Sep 17 00:00:00 2001 From: Prem Kumar Ponuthorai Date: Fri, 2 Oct 2020 15:46:42 +0200 Subject: [PATCH] fix to use token from input --- .github/workflows/main.yml | 2 +- action.yml | 4 ++++ index.js | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8773774..af99f17 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Get Repo Code id: get_repo_code - uses: actions/checkout@v1 + uses: actions/checkout@v2 - name: LFS Warning id: lfs_warning diff --git a/action.yml b/action.yml index 3e8030c..2cd89db 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,10 @@ name: 'LFS-warning' description: 'Checks file sizes in a Pull Request and warns of large files' inputs: + token: + required: false + description: Token used to fetch the repository + default: ${{ github.token }} filesizelimit: # id of input description: 'file size limit threshold' required: true diff --git a/index.js b/index.js index 6270072..4b73c00 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,9 @@ const core = require("@actions/core") const github = require("@actions/github") -const octokit = new github.GitHub(process.env.GITHUB_TOKEN) +const myToken = core.getInput('token') +const octokit = new github.GitHub(myToken) + const context = github.context const { owner, repo } = context.repo