Skip to content

Commit

Permalink
Don’t run bypass-checks on non "run" actions (#3644)
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 14, 2020
1 parent dd60ee1 commit c919488
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion source/features/bypass-checks.tsx
Expand Up @@ -7,7 +7,14 @@ import * as api from '../github-helpers/api';
import {getRepoURL} from '../github-helpers';

async function bypass(detailsLink: HTMLAnchorElement): Promise<void> {
const runId = new URLSearchParams(detailsLink.search).get('check_run_id') ?? detailsLink.pathname.split('/').pop()!;
const runId = pageDetect.isActionJobRun(detailsLink) ?
detailsLink.pathname.split('/').pop() : // https://github.com/xojs/xo/runs/1104625522
new URLSearchParams(detailsLink.search).get('check_run_id'); // https://github.com/sindresorhus/refined-github/pull/3629/checks?check_run_id=1223857819
if (!runId) {
// Sometimes the URL doesn't point to Checks at all
return;
}

const directLink = await api.v3(`repos/${getRepoURL()}/check-runs/${runId}`);
detailsLink.href = directLink.details_url;
}
Expand Down

0 comments on commit c919488

Please sign in to comment.