| 25 | }; |
| 26 | |
| 27 | async function getRepositoryInfo(): Promise<RepositoryInfo> { |
| 28 | const {repository} = await api.v4(GetRepoInfo); |
| 29 | |
| 30 | let ciCommit: string | undefined; |
| 31 | if (!repository.isEmpty && repository.defaultBranchRef) { |
| 32 | // Check earlier commits just in case the last one is CI-generated and doesn't have checks |
| 33 | for (const commit of repository.defaultBranchRef.target.history.nodes) { |
| 34 | if (!commit.statusCheckRollup) { |
| 35 | continue; |
| 36 | } |
| 37 | |
| 38 | ciCommit = commit.oid; |
| 39 | break; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | return { |
| 44 | ...repository, |
| 45 | ciCommit, |
| 46 | }; |
| 47 | } |
| 48 | |
| 49 | function prepareForAddition(element: HTMLElement): void { |
| 50 | if (!element.classList.contains('AppHeader-context-item')) { |