MCPcopy Create free account
hub / github.com/refined-github/refined-github / addReleaseBanner

Function addReleaseBanner

source/features/closing-remarks.tsx:80–109  ·  view source on GitHub ↗
(text: string | JSX.Element, signal: AbortSignal)

Source from the content-addressed store, hash-verified

78}
79
80async function addReleaseBanner(text: string | JSX.Element, signal: AbortSignal): Promise<void> {
81 const [releases] = await getReleasesCount();
82 if (releases === 0) {
83 return;
84 }
85
86 const url = createReleaseUrl();
87 const bannerContent = {
88 text,
89 icon: <TagIcon className="m-0 tmp-m-0" />,
90 classes: ['rgh-bg-none'],
91 } satisfies BannerProps;
92
93 if (await userHasPushAccess()) {
94 Object.assign(bannerContent, {
95 action: url,
96 buttonLabel: 'Draft a new release',
97 });
98 }
99
100 // Use observer because GitHub might remove the box
101 // https://github.com/refined-github/refined-github/issues/9460
102 observe(commentBoxHashPr, anchor => {
103 anchor.before(
104 <TimelineItem>
105 {createBanner(bannerContent)}
106 </TimelineItem>,
107 );
108 }, {signal});
109}
110
111async function init(signal: AbortSignal): Promise<void> {
112 const mergeCommit = $(`.TimelineItem.js-details-container.Details a[href^="/${getRepo()!.nameWithOwner}/commit/" i]`);

Callers 1

initFunction · 0.85

Calls 6

getReleasesCountFunction · 0.85
createReleaseUrlFunction · 0.85
userHasPushAccessFunction · 0.85
observeFunction · 0.85
createBannerFunction · 0.85
assignMethod · 0.80

Tested by

no test coverage detected