From a4633efcd4330307371369320c9c4c8bf7c0599a Mon Sep 17 00:00:00 2001 From: Eddie Jaoude Date: Sat, 5 Sep 2020 08:07:13 +0200 Subject: [PATCH] fix(action): remove repo, context parameters #1 --- .github/workflows/community.yml | 2 -- action.yml | 6 ------ index.js | 10 ++++------ 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/community.yml b/.github/workflows/community.yml index b92f024..3fd7cdf 100644 --- a/.github/workflows/community.yml +++ b/.github/workflows/community.yml @@ -11,5 +11,3 @@ jobs: - uses: EddieJaoudeCommunity/gh-action-community@main with: github-token: ${{secrets.GITHUB_TOKEN}} - repo: ${{ toJson(github) }} - context: ${{ toJson(context) }} diff --git a/action.yml b/action.yml index f9d903d..1b09a60 100644 --- a/action.yml +++ b/action.yml @@ -4,12 +4,6 @@ inputs: github-token: description: 'repo access' required: true - repo: - description: 'repo info' - required: true - context: - description: 'context of repo' - required: true runs: using: 'node12' main: 'index.js' diff --git a/index.js b/index.js index 2c4bf26..d28cf7b 100644 --- a/index.js +++ b/index.js @@ -4,16 +4,14 @@ const github = require('@actions/github'); (async () => { try { // const githubSecret = core.getInput('github-secret'); - const repo = core.getInput('repo'); - const context = core.getInput('context'); const creator = context.payload.sender.login; - const opts = repo.issues.listForRepo.endpoint.merge({ + const opts = github.issues.listForRepo.endpoint.merge({ ...context.issue, creator, state: 'all', }); - const issues = await repo.paginate(opts); + const issues = await github.paginate(opts); for (const issue of issues) { if (issue.number === context.issue.number) { @@ -27,8 +25,8 @@ const github = require('@actions/github'); await repo.issues.createComment({ issue_number: github.context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, + owner: context.github.owner, + repo: context.github.repo, body: 'Welcome, new contributor!', }); } catch (error) {