Files
angular__angular/tools/dashboard/functions/github/github-status.ts
T
Paul Gschwendtner c021e94fce chore(dashboard): http function to list pull requests with conflicts (#6675)
Introduces a new http trigger in the Dashboard functions that returns all Pull Requests with merge conflicts. This allows us to show a list of PRs with merge conflicts in the dashboard.

To ensure that the API calls are as fast as possible, the pull requests with conflicts are queried using Github's new GraphQL API.
2017-09-28 16:05:46 -07:00

25 lines
614 B
TypeScript

import {githubApiV3} from './github-api';
/** Data that must be specified to set a Github PR status. */
export type GithubStatusData = {
result: boolean;
name: string;
description: string;
url?: string;
};
/** Function that sets a Github commit status */
export function setGithubStatus(commitSHA: string, data: GithubStatusData) {
const state = data.result ? 'success' : 'failure';
return githubApiV3.repos.createStatus({
owner: 'angular',
repo: 'material2',
sha: commitSHA,
state: state,
target_url: data.url,
description: data.description,
context: data.name,
});
}