Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unbreak future reviewdog #639

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion actions/main/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 22 additions & 3 deletions src/steps/assigneesAfter.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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
Expand All @@ -37,6 +55,7 @@ export default async function assigneesAfter ({
)
).map(
e => e.comments.nodes[0].body
.replace(/\n<!--(.*) -->\n/, '')
.replace(/.*<br>Cc(.*)/, '$1')
.replaceAll('@', '').trim().split(' ')
).flat())]
Expand Down