Skip to content

Commit

Permalink
🐛 FIX: Filter git payload
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Aug 17, 2020
1 parent 69ea529 commit 4a3689d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/assets/funcs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
export function collectBenchesPerTestCasePerGroup(entries) {
const map = new Map();
for (const entry of entries) {
const { commit, date, tool, benches, cpu } = entry;
const { commit, date, benches, cpu, extra } = entry;
for (const bench of benches) {
const result = { commit, date, tool, bench, cpu };
const result = { commit, date, bench, cpu, extra };
const group = bench.group ? bench.group : null
var gmap = map.get(group);
if (gmap === undefined) {
Expand Down
10 changes: 9 additions & 1 deletion src/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,15 @@ function getHumanReadableUnitValue(seconds: number): [number, string] {
function getCommit(): Commit {
/* eslint-disable @typescript-eslint/camelcase */
if (github.context.payload.head_commit) {
return github.context.payload.head_commit;
const { id, message, timestamp, url, distinct, tree_id } = github.context.payload.head_commit;
const output = { id, message, timestamp, url, distinct, tree_id } as Commit;
if (output.distinct === undefined) {
delete output.distinct;
}
if (output.tree_id === undefined) {
delete output.tree_id;
}
return output;
}

const pr = github.context.payload.pull_request;
Expand Down
2 changes: 1 addition & 1 deletion test/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('extractResult()', function() {
};
const bench = await extractResult(config);

A.equal(bench.commit, dummyWebhookPayload.head_commit);
A.deepEqual(bench.commit, dummyWebhookPayload.head_commit);
A.ok(bench.date <= Date.now(), bench.date.toString());
A.deepEqual(test.expected, bench.benches);
});
Expand Down

0 comments on commit 4a3689d

Please sign in to comment.