Skip to content
Permalink
Browse files
Create/Update check run
  • Loading branch information
LouisBrunner committed Feb 29, 2020
1 parent a7e605d commit b8b3df64d77768eb202194037bef4cb2977e6829
Showing 5 changed files with 42 additions and 9 deletions.
@@ -96,4 +96,4 @@ Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
lib
@@ -1,7 +1,21 @@
# GitHub Actions: `checks-action` ![build-test](https://github.com/LouisBrunner/checks-action/workflows/build-test/badge.svg)

TODO: description
TODO: description & usage

# Usage
## Inputs

TODO: usage
### `who-to-greet`

**Required** The name of the person to greet. Default `"World"`.

## Outputs

### `time`

The time we greeted you.

## Example usage

uses: actions/hello-world-javascript-action@v1
with:
who-to-greet: 'Mona the Octocat'
@@ -5,7 +5,7 @@ import * as path from 'path'
// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
process.env['TOKEN'] = 'ABC'
const ip = path.join(__dirname, '..', 'dist', 'index.js')
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecSyncOptions = {
env: process.env,
}

Some generated files are not rendered by default. Learn more.

@@ -9,14 +9,33 @@ async function run(): Promise<void> {
core.debug(`Setting up OctoKit`)
const octokit = new github.GitHub(token)

const checkRuns = octokit.checks.listForRef({
const ownership = {
owner: github.context.repo.owner,
repo: github.context.repo.repo,
}

const info = { // TODO: from argument
}

const { data } = await octokit.checks.listForRef({
...ownership,
ref: github.context.sha,
})
core.info(JSON.stringify(checkRuns))

// TODO: finish
if (data.check_runs.length > 0) {
octokit.checks.update({
...ownership,
check_run_id: data.check_runs[0].id,
...info,
})
} else {
octokit.checks.create({
...ownership,
head_sha: github.context.sha,
name: 'Check Run Test', // TODO: from argument
...info,
})
}
} catch (error) {
core.setFailed(error.message)
}

0 comments on commit b8b3df6

Please sign in to comment.