Skip to content

Commit b004662

Browse files
Create div>
1 parent 6701b78 commit b004662

File tree

1 file changed

+44
-0
lines changed
  • .github/workflows/<div id="status" class="signature">Status: <em>Loading...</em><

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<script>
2+
async function triggerWorkflows() {
3+
const statusEl = document.getElementById("status");
4+
5+
// Trigger the workflows
6+
const triggerResponse = await fetch("https://api.github.com/repos/chaishillomnitech1/Chaishillomnitech1/dispatches", {
7+
method: "POST",
8+
headers: {
9+
"Authorization": "Bearer YOUR_GITHUB_PERSONAL_ACCESS_TOKEN", // Replace securely
10+
"Accept": "application/vnd.github.everest-preview+json",
11+
"Content-Type": "application/json"
12+
},
13+
body: JSON.stringify({ event_type: "trigger-all-workflows" })
14+
});
15+
16+
if (triggerResponse.ok) {
17+
statusEl.innerHTML = "Trigger sent. Checking status...";
18+
19+
// Wait 3–5 seconds before checking status
20+
setTimeout(checkWorkflowStatus, 4000);
21+
} else {
22+
statusEl.innerHTML = "Trigger failed. Check token or config.";
23+
}
24+
}
25+
26+
async function checkWorkflowStatus() {
27+
const statusEl = document.getElementById("status");
28+
29+
const response = await fetch("https://api.github.com/repos/chaishillomnitech1/Chaishillomnitech1/actions/runs", {
30+
headers: {
31+
"Authorization": "Bearer YOUR_GITHUB_PERSONAL_ACCESS_TOKEN"
32+
}
33+
});
34+
35+
const data = await response.json();
36+
const latest = data.workflow_runs?.[0];
37+
38+
if (latest) {
39+
statusEl.innerHTML = `Latest Run: <strong>${latest.name}</strong><br>Status: <strong>${latest.status}</strong> — Conclusion: <strong>${latest.conclusion}</strong>`;
40+
} else {
41+
statusEl.innerHTML = "No recent workflow runs found.";
42+
}
43+
}
44+
</script>

0 commit comments

Comments
 (0)