diff --git a/actions/main/action.yml b/actions/main/action.yml index 05cc2ae8..f23f874a 100644 --- a/actions/main/action.yml +++ b/actions/main/action.yml @@ -91,7 +91,7 @@ runs: - if: ${{ steps.reviewdog-enabled.outputs.result == 'true' }} uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v1.3.0 with: - reviewdog_version: v0.18.0 # Optional. [latest,nightly,v.X.Y.Z] + reviewdog_version: v0.18.1 # Optional. [latest,nightly,v.X.Y.Z] - if: ${{ steps.reviewdog-enabled.outputs.result == 'true' }} name: Setup Ruby id: ruby diff --git a/src/steps/assigneesAfter.js b/src/steps/assigneesAfter.js index ed8d1114..81f2abd1 100644 --- a/src/steps/assigneesAfter.js +++ b/src/steps/assigneesAfter.js @@ -1,8 +1,26 @@ export default async function assigneesAfter ({ github, + githubToken, context, + owner, + repo, + number, assignees }) { + if (!github && githubToken) { + const { Octokit } = await import('octokit') + + github = new Octokit({ auth: githubToken }) + } + + if (!github) { + throw new Error('github or githubToken is required') + } + + if (typeof number === 'string') { + number = parseInt(number, 10) + } + const query = `query($owner:String!, $name:String!, $prnumber:Int!) { repository(owner:$owner, name:$name) { pullRequest(number:$prnumber) { @@ -24,9 +42,9 @@ export default async function assigneesAfter ({ } }` const variables = { - owner: context.repo.owner, - name: context.repo.repo, - prnumber: context.issue.number + owner: owner || context.repo.owner, + name: repo || context.repo.repo, + prnumber: number || context.issue.number } const result = await github.graphql(query, variables) const threads = result.repository.pullRequest.reviewThreads @@ -37,6 +55,7 @@ export default async function assigneesAfter ({ ) ).map( e => e.comments.nodes[0].body + .replace(/\n\n/, '') .replace(/.*
Cc(.*)/, '$1') .replaceAll('@', '').trim().split(' ') ).flat())]