diff --git a/source/features/bypass-checks.tsx b/source/features/bypass-checks.tsx index 776a3017ee0..35306b5457d 100644 --- a/source/features/bypass-checks.tsx +++ b/source/features/bypass-checks.tsx @@ -7,7 +7,14 @@ import * as api from '../github-helpers/api'; import {getRepoURL} from '../github-helpers'; async function bypass(detailsLink: HTMLAnchorElement): Promise { - 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; }