MCPcopy Index your code
hub / github.com/refined-github/refined-github / addToReleases

Function addToReleases

source/features/unreleased-commits.tsx:140–166  ·  view source on GitHub ↗
(releasesFilter: HTMLInputElement)

Source from the content-addressed store, hash-verified

138}
139
140async 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
168async function addToNewRelease(header: HTMLElement): Promise<void> {
169 const {latestTag, aheadBy} = await repoPublishState.get();

Callers

nothing calls this directly

Calls 3

groupButtonsFunction · 0.85
getMethod · 0.80
createLinkFunction · 0.70

Tested by

no test coverage detected