(releasesFilter: HTMLInputElement)
| 138 | } |
| 139 | |
| 140 | async function addToReleases(releasesFilter: HTMLInputElement): Promise<void> { |
| 141 | const {latestTag, aheadBy} = await repoPublishState.get(); |
| 142 | const isAhead = aheadBy > 0; |
| 143 | |
| 144 | if (!latestTag || !isAhead) { |
| 145 | return; |
| 146 | } |
| 147 | |
| 148 | const widget = await createLink(latestTag, aheadBy); |
| 149 | |
| 150 | // Prepend it to the existing "Draft a new release" button to match the button on the repo home |
| 151 | const newReleaseButton = $optional('nav + div a[href$="/releases/new"]'); |
| 152 | if (newReleaseButton) { |
| 153 | newReleaseButton.before(widget); |
| 154 | groupButtons([ |
| 155 | widget, |
| 156 | newReleaseButton, |
| 157 | ]); |
| 158 | return; |
| 159 | } |
| 160 | |
| 161 | // Otherwise, add it before filter input |
| 162 | releasesFilter.form!.before(widget); |
| 163 | releasesFilter.form!.parentElement!.classList.add('d-flex', 'flex-items-start'); |
| 164 | // The form has .ml-md-2, this restores it on `sm` |
| 165 | widget.classList.add('mr-md-0', 'mr-2'); |
| 166 | } |
| 167 | |
| 168 | async function addToNewRelease(header: HTMLElement): Promise<void> { |
| 169 | const {latestTag, aheadBy} = await repoPublishState.get(); |
nothing calls this directly
no test coverage detected