@@ -18,17 +18,17 @@ jobs:
1818 env :
1919 FORUM_URL : " https://hub.jmonkeyengine.org/t/proposal-experimental-bounty-program-in-jme/49385"
2020 RESERVE_HOURS : " 48"
21+ TIMER_SVG_BASE : " https://jme-bounty-reservation-indicator.rblb.workers.dev/timer.svg"
2122 with :
2223 script : |
2324 const issue = context.payload.issue;
24- const label = context.payload.label?.name ?? "";
25- const actor = context.actor; // person who applied the label
26- const issueOwner = issue.user?.login; // original issue author
27-
25+ const actor = context.actor;
26+ const issueOwner = issue.user?.login;
2827 if (!issueOwner) return;
2928
3029 const forumUrl = process.env.FORUM_URL || "TBD";
3130 const reserveHours = Number(process.env.RESERVE_HOURS || "48");
31+ const svgBase = process.env.TIMER_SVG_BASE || "";
3232
3333 // "previous contributor" = has at least one merged PR authored in this repo
3434 const repoFull = `${context.repo.owner}/${context.repo.repo}`;
4646 const shouldReserve = isPreviousContributor && (actor !== issueOwner);
4747
4848 const lines = [];
49- lines.push(`# 💰 This issue has a bounty`);
49+ lines.push(`## 💰 This issue has a bounty`);
5050 lines.push(`Resolve it to receive a reward.`);
5151 lines.push(`For details (amount, rules, eligibility), see: ${forumUrl}`);
5252 lines.push("");
@@ -55,17 +55,17 @@ jobs:
5555 lines.push(`If accepted by a maintainer, the issue will be **assigned** to you.`);
5656 lines.push("");
5757
58- if (shouldReserve) {
58+ if (shouldReserve && svgBase ) {
5959 const reservedUntil = new Date(Date.now() + reserveHours * 60 * 60 * 1000);
6060 const reservedUntilIso = reservedUntil.toISOString();
6161
62- lines.push(
63- `<sub> ` +
64- `⏳ **Temporary reservation for @${issueOwner}:** since they are a previous contributor, they have priority for this bounty ` +
65- `for <relative-time datetime="${reservedUntilIso}"></relative-time> ` +
66- `(until **${reservedUntilIso}**). After that, it is **open to everyone**.` +
67- `</sub>`
68- );
62+ const svgUrl =
63+ `${svgBase} ` +
64+ `?until=${encodeURIComponent(reservedUntilIso)} ` +
65+ `&user=${encodeURIComponent(issueOwner)} ` +
66+ `&theme=dark`;
67+
68+ lines.push(`` );
6969 lines.push("");
7070 }
7171
0 commit comments