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.1
Browse files Browse the repository at this point in the history
  • Loading branch information
svartalf committed Sep 27, 2019
1 parent a9a301c commit adea964
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 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.1] - 2019-09-27

### Fixed

- Successful check without any warnings or errors was not terminated properly

## [1.0.0] - 2019-09-27

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

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rust-clippy-check",
"version": "1.0.0",
"version": "1.0.1",
"private": false,
"description": "Run clippy and annotate the diff with errors and warnings",
"main": "lib/main.js",
Expand Down
33 changes: 32 additions & 1 deletion src/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ ${this.stats.help} help`);
userAgent: USER_AGENT,
});
const checkRunId = await this.createCheck(client, options);
await this.runUpdateCheck(client, checkRunId, options);
if (this.isSuccessCheck()) {
await this.successCheck(client, checkRunId, options);
} else {
await this.runUpdateCheck(client, checkRunId, options);
}

return;
}
Expand Down Expand Up @@ -159,6 +163,28 @@ ${this.stats.help} help`);
return;
}

private async successCheck(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: this.getConclusion(),
completed_at: new Date().toISOString(),
output: {
title: options.name,
summary: this.getSummary(),
text: this.getText(options.context),
}
};

// 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> = [];
Expand Down Expand Up @@ -223,6 +249,11 @@ ${this.stats.help} help`);
}
}

private isSuccessCheck(): boolean {
return this.stats.ice == 0 && this.stats.error == 0 && this.stats.warning == 0 &&
this.stats.note == 0 && this.stats.help == 0;
}

/// Convert parsed JSON line into the GH annotation object
///
/// https://developer.github.com/v3/checks/runs/#annotations-object
Expand Down

0 comments on commit adea964

Please sign in to comment.