Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Release v1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
svartalf committed Oct 1, 2019
1 parent 6bb8365 commit 6606cb9
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 14 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.3] - 2019-10-01

### Fixed

- Properly sending check annotations in the Check Update calls (#1)

## [1.0.2] - 2019-09-27

### Added
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package-lock.json

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rust-clippy-check",
"version": "1.0.2",
"version": "1.0.3",
"private": false,
"description": "Run clippy and annotate the diff with errors and warnings",
"main": "lib/main.js",
Expand Down Expand Up @@ -36,7 +36,7 @@
},
"devDependencies": {
"@types/jest": "^24.0.13",
"@types/node": "^12.7.7",
"@types/node": "^12.7.8",
"@zeit/ncc": "^0.20.5",
"jest": "^24.9.0",
"jest-circus": "^24.9.0",
Expand Down
43 changes: 36 additions & 7 deletions src/check.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const pkg = require('../package.json');

import * as core from '@actions/core';
import * as github from '@actions/github';
import * as octokit from "@octokit/rest";

const pkg = require('../package.json');
import {plural} from './render';

const USER_AGENT = `${pkg.name}/${pkg.version} (${pkg.bugs.url})`;
Expand Down Expand Up @@ -99,10 +98,15 @@ ${this.stats.help} help`);
userAgent: USER_AGENT,
});
const checkRunId = await this.createCheck(client, options);
if (this.isSuccessCheck()) {
await this.successCheck(client, checkRunId, options);
} else {
await this.runUpdateCheck(client, checkRunId, options);
try {
if (this.isSuccessCheck()) {
await this.successCheck(client, checkRunId, options);
} else {
await this.runUpdateCheck(client, checkRunId, options);
}
} catch (error) {
await this.cancelCheck(client, checkRunId, options);
throw error;
}

return;
Expand Down Expand Up @@ -184,10 +188,33 @@ ${this.stats.help} help`);
return;
}

/// Cancel whole check if some unhandled exception happened.
private async cancelCheck(client, checkRunId: number, options: CheckOptions): Promise<void> {
let req: any = {
owner: options.owner,
repo: options.repo,
name: options.name,
check_run_id: checkRunId,
status: 'completed',
conclusion: 'cancelled',
completed_at: new Date().toISOString(),
output: {
title: options.name,
summary: 'Unhandled error',
text: 'Check was cancelled due to unhandled error. Check the Action logs for details.',
}
};

// TODO: Check for errors
await client.checks.update(req);

return;
}

private getBucket(): Array<octokit.ChecksCreateParamsOutputAnnotations> {
// TODO: Use slice or smth?
let annotations: Array<octokit.ChecksCreateParamsOutputAnnotations> = [];
while (annotations.length <= 50) {
while (annotations.length < 50) {
const annotation = this.annotations.pop();
if (annotation) {
annotations.push(annotation);
Expand All @@ -196,6 +223,8 @@ ${this.stats.help} help`);
}
}

core.debug(`Prepared next annotations bucket, ${annotations.length} size`);

return annotations;
}

Expand Down

0 comments on commit 6606cb9

Please sign in to comment.