Skip to content

Commit 8ed0d58

Browse files
committed
Add sha to result
1 parent cdd0754 commit 8ed0d58

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

functions/github.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ export function updateGithubStatus(event: firebaseFunctions.Event<any>) {
2020
}
2121
let result = event.data.val() == true;
2222
let prNumber = event.params.prNumber;
23-
return event.data.ref.parent.child('sha').once('value').then((sha: firebaseAdmin.database.DataSnapshot) => {
24-
return setGithubStatus(sha.val(),
25-
{
26-
result: result,
27-
name: toolName,
28-
description: `${toolName} ${result ? 'passed' : 'failed'}`,
29-
url: `http://${authDomain}/${prNumber}`
30-
},
31-
repoSlug,
32-
token);
33-
});
23+
return setGithubStatus(event.params.sha,
24+
{
25+
result: result,
26+
name: toolName,
27+
description: `${toolName} ${result ? 'passed' : 'failed'}`,
28+
url: `http://${authDomain}/${prNumber}`
29+
},
30+
repoSlug,
31+
token);
3432
}

functions/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ exports.approveImages = firebaseFunctions.database.ref(approveImagesPath).onWrit
116116
* otherwise update github status to `failure`.
117117
* The Github Status Token is set in config.secret.github
118118
*/
119-
const githubStatusPath = `${trustedReportPath}/result`;
119+
const githubStatusPath = `${trustedReportPath}/result/{sha}`;
120120
exports.githubStatus = firebaseFunctions.database.ref(githubStatusPath).onWrite(updateGithubStatus);

tools/gulp/tasks/screenshots.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ function updateFileResult(database: firebase.database.Database, prNumber: string
5050
}
5151

5252
function updateResult(database: firebase.database.Database, prNumber: string, result: boolean) {
53-
return getPullRequestRef(database, prNumber).child('result').set(result).then(() => result);
53+
return getPullRequestRef(database, prNumber).child('result')
54+
.child(process.env['TRAVIS_PULL_REQUEST_SHA']).set(result).then(() => result);
5455
}
5556

5657
function getPullRequestRef(database: firebase.database.Database | admin.database.Database,

0 commit comments

Comments
 (0)