Skip to content

Commit

Permalink
Use API for bypass-checks (#3629)
Browse files Browse the repository at this point in the history
Co-authored-by: Federico <me@fregante.com>
  • Loading branch information
yakov116 and fregante committed Oct 9, 2020
1 parent e02532a commit ac32e2c
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions source/features/bypass-checks.tsx
Expand Up @@ -3,17 +3,13 @@ import {observe} from 'selector-observer';
import * as pageDetect from 'github-url-detection';

import features from '.';
import fetchDom from '../helpers/fetch-dom';
import * as api from '../github-helpers/api';
import {getRepoURL} from '../github-helpers';

async function bypass(detailsLink: HTMLAnchorElement): Promise<void> {
const directLink = await fetchDom<HTMLAnchorElement>(
detailsLink.href,
'[data-hydro-click*="check_suite.external_click"]'
);

if (directLink) {
detailsLink.href = directLink.href;
}
const runId = new URLSearchParams(detailsLink.search).get('check_run_id') ?? detailsLink.pathname.split('/').pop()!;
const directLink = await api.v3(`repos/${getRepoURL()}/check-runs/${runId}`);
detailsLink.href = directLink.details_url;
}

function init(): void {
Expand Down

0 comments on commit ac32e2c

Please sign in to comment.