Skip to content

Commit e7eb4c1

Browse files
authored
Workflow badge customizations
1 parent e59a877 commit e7eb4c1

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

  • archive/web-tools/gh-boards

archive/web-tools/gh-boards/app.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,16 +235,20 @@ document.addEventListener('DOMContentLoaded', () => {
235235
// No repo field — user-level badge
236236
optionsHTML = colorRow(art, index);
237237
} else if (art.type === 'badge_workflow') {
238-
// Repo + optional workflow file
238+
// Repo + optional workflow file + optional custom label
239239
optionsHTML = `
240-
<div class="grid-layout" style="grid-template-columns: 1fr 1fr; gap: 1rem;">
240+
<div class="grid-layout" style="grid-template-columns: 1fr 1fr 1fr; gap: 1rem;">
241241
<div class="form-group">
242242
<label>Repository Name</label>
243243
<input type="text" class="art-repo" value="${art.options.repo || ''}" data-idx="${index}" placeholder="e.g. my-project">
244244
</div>
245245
<div class="form-group">
246246
<label>Workflow File <small style="color:var(--text-muted)">(optional)</small></label>
247-
<input type="text" class="art-workflow" value="${art.options.workflow || ''}" data-idx="${index}" placeholder="e.g. ci.yml or leave blank for latest">
247+
<input type="text" class="art-workflow" value="${art.options.workflow || ''}" data-idx="${index}" placeholder="e.g. ci.yml">
248+
</div>
249+
<div class="form-group">
250+
<label>Custom Label <small style="color:var(--text-muted)">(optional)</small></label>
251+
<input type="text" class="art-label" value="${art.options.label || ''}" data-idx="${index}" placeholder="e.g. Windows Build">
248252
</div>
249253
</div>
250254
` + colorRow(art, index);
@@ -321,6 +325,14 @@ document.addEventListener('DOMContentLoaded', () => {
321325
});
322326
});
323327

328+
// Custom label input
329+
document.querySelectorAll('.art-label').forEach(input => {
330+
input.addEventListener('input', (e) => {
331+
const idx = e.target.dataset.idx;
332+
state.artifacts[idx].options.label = e.target.value;
333+
updatePreview();
334+
});
335+
});
324336
// Color pickers (sync with text inputs)
325337
document.querySelectorAll('.art-color').forEach(input => {
326338
input.addEventListener('input', (e) => {
@@ -433,6 +445,8 @@ document.addEventListener('DOMContentLoaded', () => {
433445
if (art.options.repo) result.options.repo = art.options.repo;
434446
// Include workflow file if present
435447
if (art.options.workflow) result.options.workflow = art.options.workflow;
448+
// Include custom label if present
449+
if (art.options.label) result.options.label = art.options.label;
436450
} else {
437451
result.options = {
438452
max_repos: art.options.max_repos || 10,
@@ -535,6 +549,8 @@ document.addEventListener('DOMContentLoaded', () => {
535549
if (firstArt.options.color) params.set('color', firstArt.options.color);
536550
// Add workflow file if set
537551
if (firstArt.options.workflow) params.set('workflow', firstArt.options.workflow);
552+
// Add custom label if set
553+
if (firstArt.options.label) params.set('label', firstArt.options.label);
538554
apiUrl = `${API_BASE_URL}/api/badge?${params.toString()}`;
539555
}
540556

0 commit comments

Comments
 (0)