File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
.github/workflows/<div id="status" class="signature">Status: <em>Loading...</em>< Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 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>
You can’t perform that action at this time.
0 commit comments