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

Fetch up to 100 check runs in a single poll request #9

Merged
merged 1 commit into from
Jul 27, 2023
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
4 changes: 2 additions & 2 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { wait } from '../src/wait'
import { expect, test } from '@jest/globals'
import {wait} from '../src/wait'
import {expect, test} from '@jest/globals'

test('throws invalid number', async () => {
const input = parseInt('foo', 10)
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import * as core from '@actions/core'
import * as github from '@actions/github'
import { Context } from '@actions/github/lib/context'
import { poll } from './poll'
import {Context} from '@actions/github/lib/context'
import {poll} from './poll'

async function run(): Promise<void> {
try {
// read inputs
const token = core.getInput('token', { required: true })
const token = core.getInput('token', {required: true})

// github context
const context = github.context
Expand Down
27 changes: 14 additions & 13 deletions src/poll.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { GitHub } from '@actions/github/lib/utils'
import {GitHub} from '@actions/github/lib/utils'
import * as core from '@actions/core'
import { wait } from './wait'
import {wait} from './wait'

export interface Config {
client: InstanceType<typeof GitHub>
Expand Down Expand Up @@ -41,7 +41,8 @@ export async function poll(config: Config): Promise<void> {
const response = await client.rest.checks.listForRef({
owner,
repo,
ref
ref,
per_page: 100
})

core.debug(`Received ${response.data.total_count} total check runs`)
Expand Down Expand Up @@ -117,14 +118,14 @@ interface CheckRun {
name: string
status: string
conclusion:
| (
| 'success'
| 'failure'
| 'neutral'
| 'cancelled'
| 'skipped'
| 'timed_out'
| 'action_required'
)
| null
| (
| 'success'
| 'failure'
| 'neutral'
| 'cancelled'
| 'skipped'
| 'timed_out'
| 'action_required'
)
| null
}