@hybridlabor-api/aos 4.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/.agents/agents.md +1 -1
  2. package/.agents/nodes.json +1 -1
  3. package/.agents/vendor-manifest.json +23 -1
  4. package/.claude/agents/godmode-media-eventtech.md +1 -1
  5. package/.claude/hooks/conventional-commits.mjs +125 -0
  6. package/.claude/hooks/env-file-protection.mjs +105 -0
  7. package/.claude/hooks/go-gate.mjs +101 -81
  8. package/.claude/settings.json +13 -0
  9. package/.opencode/agents/godmode-media-eventtech.md +1 -1
  10. package/.opencode/plugins/bdb-aos.js +31 -4
  11. package/README.de.md +1 -1
  12. package/README.md +1 -1
  13. package/README.pt.md +1 -1
  14. package/THIRD_PARTY_NOTICES.md +88 -0
  15. package/docs/skills_table.md +1 -1
  16. package/installer.js +174 -46
  17. package/package.json +6 -2
  18. package/packages/aos-cli/README.md +80 -0
  19. package/packages/aos-cli/bin/aos-cli.mjs +134 -0
  20. package/packages/aos-cli/core-skills.json +12 -0
  21. package/packages/aos-cli/extensions/aos.ts +321 -0
  22. package/packages/aos-cli/package-lock.json +1923 -0
  23. package/packages/aos-cli/package.json +29 -0
  24. package/packages/aos-cli/scripts/check-theme.mjs +63 -0
  25. package/packages/aos-cli/themes/aos.json +97 -0
  26. package/scripts/build-plugin-manifest.mjs +131 -0
  27. package/scripts/validate-skills.mjs +81 -6
  28. package/skills/basic/ao-orchestrator/SKILL.md +116 -0
  29. package/skills/global_config/agenttrail/SKILL.md +6 -1
  30. package/skills/global_config/ask-tim/SKILL.md +4 -4
  31. package/skills/global_config/bash-script-generator/SKILL.md +201 -0
  32. package/skills/global_config/bash-script-generator/assets/templates/standard-template.sh +96 -0
  33. package/skills/global_config/bash-script-generator/docs/bash-scripting-guide.md +729 -0
  34. package/skills/global_config/bash-script-generator/docs/generation-best-practices.md +193 -0
  35. package/skills/global_config/bash-script-generator/docs/script-patterns.md +566 -0
  36. package/skills/global_config/bash-script-generator/docs/text-processing-guide.md +437 -0
  37. package/skills/global_config/bash-script-generator/examples/log-analyzer.sh +92 -0
  38. package/skills/global_config/bash-script-generator/scripts/generate_script_template.sh +123 -0
  39. package/skills/global_config/bash-script-generator/scripts/run_ci_checks.sh +172 -0
  40. package/skills/global_config/bash-script-generator/scripts/test_generator.sh +413 -0
  41. package/skills/global_config/bash-script-validator/SKILL.md +249 -0
  42. package/skills/global_config/bash-script-validator/docs/awk-reference.md +449 -0
  43. package/skills/global_config/bash-script-validator/docs/bash-reference.md +468 -0
  44. package/skills/global_config/bash-script-validator/docs/common-mistakes.md +623 -0
  45. package/skills/global_config/bash-script-validator/docs/grep-reference.md +395 -0
  46. package/skills/global_config/bash-script-validator/docs/regex-reference.md +391 -0
  47. package/skills/global_config/bash-script-validator/docs/sed-reference.md +454 -0
  48. package/skills/global_config/bash-script-validator/docs/shell-reference.md +463 -0
  49. package/skills/global_config/bash-script-validator/docs/shellcheck-reference.md +399 -0
  50. package/skills/global_config/bash-script-validator/examples/bad-bash.sh +55 -0
  51. package/skills/global_config/bash-script-validator/examples/bad-shell.sh +54 -0
  52. package/skills/global_config/bash-script-validator/examples/good-bash.sh +71 -0
  53. package/skills/global_config/bash-script-validator/examples/good-shell.sh +69 -0
  54. package/skills/global_config/bash-script-validator/scripts/run_ci_checks.sh +23 -0
  55. package/skills/global_config/bash-script-validator/scripts/shellcheck_wrapper.sh +174 -0
  56. package/skills/global_config/bash-script-validator/scripts/test_validate.sh +446 -0
  57. package/skills/global_config/bash-script-validator/scripts/validate.sh +512 -0
  58. package/skills/global_config/ci-pipeline/SKILL.md +135 -0
  59. package/skills/global_config/dispatching-parallel-agents/SKILL.md +170 -0
  60. package/skills/global_config/dockerfile-generator/SKILL.md +1038 -0
  61. package/skills/global_config/dockerfile-generator/examples/example.dockerignore +95 -0
  62. package/skills/global_config/dockerfile-generator/examples/golang-distroless.Dockerfile +34 -0
  63. package/skills/global_config/dockerfile-generator/examples/java-springboot.Dockerfile +45 -0
  64. package/skills/global_config/dockerfile-generator/examples/nextjs-production.Dockerfile +49 -0
  65. package/skills/global_config/dockerfile-generator/examples/nodejs-multistage.Dockerfile +55 -0
  66. package/skills/global_config/dockerfile-generator/examples/python-fastapi.Dockerfile +48 -0
  67. package/skills/global_config/dockerfile-generator/references/language_specific_guides.md +510 -0
  68. package/skills/global_config/dockerfile-generator/references/multistage_builds.md +570 -0
  69. package/skills/global_config/dockerfile-generator/references/optimization_patterns.md +492 -0
  70. package/skills/global_config/dockerfile-generator/references/security_best_practices.md +375 -0
  71. package/skills/global_config/dockerfile-generator/scripts/generate_dockerignore.sh +199 -0
  72. package/skills/global_config/dockerfile-generator/scripts/generate_golang.sh +172 -0
  73. package/skills/global_config/dockerfile-generator/scripts/generate_java.sh +185 -0
  74. package/skills/global_config/dockerfile-generator/scripts/generate_nodejs.sh +279 -0
  75. package/skills/global_config/dockerfile-generator/scripts/generate_python.sh +218 -0
  76. package/skills/global_config/dockerfile-generator/scripts/test_generator.sh +210 -0
  77. package/skills/global_config/dockerfile-validator/SKILL.md +300 -0
  78. package/skills/global_config/dockerfile-validator/examples/.dockerignore.example +34 -0
  79. package/skills/global_config/dockerfile-validator/examples/bad-example.Dockerfile +37 -0
  80. package/skills/global_config/dockerfile-validator/examples/golang-distroless.Dockerfile +50 -0
  81. package/skills/global_config/dockerfile-validator/examples/good-example.Dockerfile +52 -0
  82. package/skills/global_config/dockerfile-validator/examples/python-optimized.Dockerfile +53 -0
  83. package/skills/global_config/dockerfile-validator/examples/security-issues.Dockerfile +42 -0
  84. package/skills/global_config/dockerfile-validator/references/docker_best_practices.md +348 -0
  85. package/skills/global_config/dockerfile-validator/references/optimization_guide.md +473 -0
  86. package/skills/global_config/dockerfile-validator/references/security_checklist.md +208 -0
  87. package/skills/global_config/dockerfile-validator/scripts/dockerfile-validate.sh +699 -0
  88. package/skills/global_config/dockerfile-validator/scripts/test_validate.sh +35 -0
  89. package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn-lock-read.Dockerfile +6 -0
  90. package/skills/global_config/dockerfile-validator/tests/fixtures/copy-before-yarn.Dockerfile +6 -0
  91. package/skills/global_config/dockerfile-validator/tests/fixtures/from-platform-nonroot.Dockerfile +7 -0
  92. package/skills/global_config/dockerfile-validator/tests/test_regression.sh +164 -0
  93. package/skills/global_config/finishing-a-development-branch/SKILL.md +228 -0
  94. package/skills/global_config/github-actions-generator/SKILL.md +353 -0
  95. package/skills/global_config/github-actions-generator/assets/templates/action/composite/action.yml +82 -0
  96. package/skills/global_config/github-actions-generator/assets/templates/action/docker/Dockerfile +25 -0
  97. package/skills/global_config/github-actions-generator/assets/templates/action/docker/action.yml +42 -0
  98. package/skills/global_config/github-actions-generator/assets/templates/action/docker/entrypoint.sh +27 -0
  99. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/action.yml +33 -0
  100. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/index.js +50 -0
  101. package/skills/global_config/github-actions-generator/assets/templates/action/javascript/package.json +27 -0
  102. package/skills/global_config/github-actions-generator/assets/templates/workflow/basic_workflow.yml +242 -0
  103. package/skills/global_config/github-actions-generator/assets/templates/workflow/reusable_workflow.yml +106 -0
  104. package/skills/global_config/github-actions-generator/examples/README.md +147 -0
  105. package/skills/global_config/github-actions-generator/examples/actions/setup-node-cached/action.yml +93 -0
  106. package/skills/global_config/github-actions-generator/examples/caching/docker-buildkit.yml +256 -0
  107. package/skills/global_config/github-actions-generator/examples/security/dependency-review.yml +62 -0
  108. package/skills/global_config/github-actions-generator/examples/security/sbom-attestation.yml +119 -0
  109. package/skills/global_config/github-actions-generator/examples/triggers/chatops-commands.yml +475 -0
  110. package/skills/global_config/github-actions-generator/examples/triggers/repository-dispatch.yml +418 -0
  111. package/skills/global_config/github-actions-generator/examples/triggers/workflow-orchestration.yml +404 -0
  112. package/skills/global_config/github-actions-generator/examples/workflows/docker-build-push.yml +68 -0
  113. package/skills/global_config/github-actions-generator/examples/workflows/go-ci.yml +161 -0
  114. package/skills/global_config/github-actions-generator/examples/workflows/monorepo-ci.yml +340 -0
  115. package/skills/global_config/github-actions-generator/examples/workflows/multi-environment-deploy.yml +406 -0
  116. package/skills/global_config/github-actions-generator/examples/workflows/nodejs-ci.yml +122 -0
  117. package/skills/global_config/github-actions-generator/examples/workflows/python-ci.yml +157 -0
  118. package/skills/global_config/github-actions-generator/examples/workflows/scheduled-tasks.yml +376 -0
  119. package/skills/global_config/github-actions-generator/references/advanced-triggers.md +917 -0
  120. package/skills/global_config/github-actions-generator/references/best-practices.md +755 -0
  121. package/skills/global_config/github-actions-generator/references/common-actions.md +715 -0
  122. package/skills/global_config/github-actions-generator/references/custom-actions.md +320 -0
  123. package/skills/global_config/github-actions-generator/references/expressions-and-contexts.md +688 -0
  124. package/skills/global_config/github-actions-generator/references/modern-features.md +421 -0
  125. package/skills/global_config/github-actions-generator/scripts/test_generator.sh +344 -0
  126. package/skills/global_config/github-actions-templates/SKILL.md +7 -0
  127. package/skills/global_config/github-actions-validator/SKILL.md +576 -0
  128. package/skills/global_config/github-actions-validator/examples/README.md +88 -0
  129. package/skills/global_config/github-actions-validator/examples/outdated-versions.yml +76 -0
  130. package/skills/global_config/github-actions-validator/examples/valid-ci.yml +79 -0
  131. package/skills/global_config/github-actions-validator/examples/with-errors.yml +47 -0
  132. package/skills/global_config/github-actions-validator/references/act_usage.md +233 -0
  133. package/skills/global_config/github-actions-validator/references/action_versions.md +122 -0
  134. package/skills/global_config/github-actions-validator/references/actionlint_usage.md +343 -0
  135. package/skills/global_config/github-actions-validator/references/common_errors.md +512 -0
  136. package/skills/global_config/github-actions-validator/references/modern_features.md +384 -0
  137. package/skills/global_config/github-actions-validator/references/runners.md +317 -0
  138. package/skills/global_config/github-actions-validator/scripts/install_tools.sh +113 -0
  139. package/skills/global_config/github-actions-validator/scripts/validate_workflow.sh +910 -0
  140. package/skills/global_config/github-actions-validator/tests/test_validate_workflow.sh +237 -0
  141. package/skills/global_config/makefile-generator/SKILL.md +614 -0
  142. package/skills/global_config/makefile-generator/assets/templates/.gitkeep +1 -0
  143. package/skills/global_config/makefile-generator/docs/makefile-structure.md +530 -0
  144. package/skills/global_config/makefile-generator/docs/optimization-guide.md +784 -0
  145. package/skills/global_config/makefile-generator/docs/patterns-guide.md +642 -0
  146. package/skills/global_config/makefile-generator/docs/security-guide.md +361 -0
  147. package/skills/global_config/makefile-generator/docs/targets-guide.md +642 -0
  148. package/skills/global_config/makefile-generator/docs/variables-guide.md +596 -0
  149. package/skills/global_config/makefile-generator/scripts/add_standard_targets.sh +539 -0
  150. package/skills/global_config/makefile-generator/scripts/generate_makefile_template.sh +690 -0
  151. package/skills/global_config/makefile-generator/test/test_helper_scripts.sh +190 -0
  152. package/skills/global_config/makefile-validator/SKILL.md +244 -0
  153. package/skills/global_config/makefile-validator/docs/bake-tool.md +1000 -0
  154. package/skills/global_config/makefile-validator/docs/best-practices.md +858 -0
  155. package/skills/global_config/makefile-validator/docs/common-mistakes.md +944 -0
  156. package/skills/global_config/makefile-validator/examples/bad-makefile.mk +77 -0
  157. package/skills/global_config/makefile-validator/examples/good-makefile.mk +103 -0
  158. package/skills/global_config/makefile-validator/scripts/test_validate.sh +382 -0
  159. package/skills/global_config/makefile-validator/scripts/validate_makefile.sh +712 -0
  160. package/skills/global_config/{MCP_Manage → mcp-manage}/SKILL.md +3 -3
  161. package/skills/global_config/requesting-code-review/SKILL.md +98 -0
  162. package/skills/global_config/requesting-code-review/code-reviewer.md +198 -0
  163. package/skills/global_config/using-git-worktrees/SKILL.md +170 -0
  164. package/skills/global_config/verification-before-completion/SKILL.md +123 -0
  165. package/skills/global_config/writing-plans/SKILL.md +126 -46
  166. package/skills/global_config/writing-plans-legacy/SKILL.md +139 -0
@@ -0,0 +1,376 @@
1
+ # Scheduled Tasks Workflow Example
2
+ # Demonstrates: Cron schedules, scheduled maintenance, dependency updates, cleanup tasks
3
+
4
+ name: Scheduled Maintenance Tasks
5
+
6
+ on:
7
+ # Run dependency audit daily at 2 AM UTC
8
+ schedule:
9
+ - cron: '0 2 * * *'
10
+
11
+ # Allow manual trigger for testing
12
+ workflow_dispatch:
13
+ inputs:
14
+ task:
15
+ description: 'Task to run'
16
+ required: false
17
+ type: choice
18
+ options:
19
+ - all
20
+ - dependency-audit
21
+ - stale-branches
22
+ - cache-cleanup
23
+ - health-check
24
+ default: 'all'
25
+
26
+ permissions:
27
+ contents: write
28
+ pull-requests: write
29
+ issues: write
30
+
31
+ concurrency:
32
+ group: ${{ github.workflow }}
33
+ cancel-in-progress: false # Don't cancel scheduled maintenance
34
+
35
+ env:
36
+ NODE_VERSION: '24'
37
+
38
+ jobs:
39
+ # Job 1: Security and dependency audit
40
+ dependency-audit:
41
+ name: Dependency Security Audit
42
+ runs-on: ubuntu-latest
43
+ if: github.event_name == 'schedule' || github.event.inputs.task == 'all' || github.event.inputs.task == 'dependency-audit'
44
+ timeout-minutes: 15
45
+
46
+ steps:
47
+ - name: Checkout code
48
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
49
+
50
+ - name: Setup Node.js
51
+ uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
52
+ with:
53
+ node-version: ${{ env.NODE_VERSION }}
54
+
55
+ - name: Run npm audit
56
+ id: audit
57
+ continue-on-error: true
58
+ run: |
59
+ npm audit --audit-level=moderate > audit-report.txt 2>&1
60
+ AUDIT_EXIT_CODE=$?
61
+ echo "exit_code=$AUDIT_EXIT_CODE" >> $GITHUB_OUTPUT
62
+ cat audit-report.txt
63
+
64
+ - name: Upload audit report
65
+ if: always()
66
+ uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
67
+ with:
68
+ name: dependency-audit-report
69
+ path: audit-report.txt
70
+ retention-days: 30
71
+
72
+ - name: Create issue if vulnerabilities found
73
+ if: steps.audit.outputs.exit_code != '0'
74
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
75
+ with:
76
+ script: |
77
+ const fs = require('fs');
78
+ const report = fs.readFileSync('audit-report.txt', 'utf8');
79
+
80
+ // Check if issue already exists
81
+ const { data: issues } = await github.rest.issues.listForRepo({
82
+ owner: context.repo.owner,
83
+ repo: context.repo.repo,
84
+ state: 'open',
85
+ labels: 'security,dependencies,automated'
86
+ });
87
+
88
+ const existingIssue = issues.find(issue =>
89
+ issue.title.includes('Security Vulnerabilities Detected')
90
+ );
91
+
92
+ if (!existingIssue) {
93
+ await github.rest.issues.create({
94
+ owner: context.repo.owner,
95
+ repo: context.repo.repo,
96
+ title: '🔒 Security Vulnerabilities Detected - ' + new Date().toISOString().split('T')[0],
97
+ body: `## Security Audit Report\n\n**Date:** ${new Date().toISOString()}\n\n### Audit Results\n\n\`\`\`\n${report}\n\`\`\`\n\n---\n*This issue was automatically created by the scheduled maintenance workflow.*`,
98
+ labels: ['security', 'dependencies', 'automated']
99
+ });
100
+ }
101
+
102
+ # Job 2: Clean up stale branches
103
+ stale-branches:
104
+ name: Cleanup Stale Branches
105
+ runs-on: ubuntu-latest
106
+ if: github.event_name == 'schedule' || github.event.inputs.task == 'all' || github.event.inputs.task == 'stale-branches'
107
+ timeout-minutes: 10
108
+
109
+ steps:
110
+ - name: Checkout code
111
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
112
+ with:
113
+ fetch-depth: 0 # Need full history for branch analysis
114
+
115
+ - name: Find stale branches
116
+ id: find-stale
117
+ run: |
118
+ # Find branches not updated in 90 days
119
+ echo "## Stale Branches (90+ days old)" > stale-branches.txt
120
+ echo "" >> stale-branches.txt
121
+
122
+ git for-each-ref --sort=-committerdate refs/remotes/origin/ --format='%(refname:short)|%(committerdate:relative)|%(authorname)' | \
123
+ while IFS='|' read -r branch date author; do
124
+ # Skip main, develop, and release branches
125
+ if [[ "$branch" =~ ^origin/(main|develop|master|release/) ]]; then
126
+ continue
127
+ fi
128
+
129
+ # Check if branch is older than 90 days
130
+ if [[ "$date" =~ "month" ]] || [[ "$date" =~ "year" ]]; then
131
+ echo "- **$branch** (Last updated: $date, Author: $author)" >> stale-branches.txt
132
+ fi
133
+ done
134
+
135
+ cat stale-branches.txt
136
+
137
+ - name: Create PR to document stale branches
138
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
139
+ with:
140
+ script: |
141
+ const fs = require('fs');
142
+ const report = fs.readFileSync('stale-branches.txt', 'utf8');
143
+
144
+ // Create or update issue
145
+ const { data: issues } = await github.rest.issues.listForRepo({
146
+ owner: context.repo.owner,
147
+ repo: context.repo.repo,
148
+ state: 'open',
149
+ labels: 'maintenance,automated'
150
+ });
151
+
152
+ const existingIssue = issues.find(issue =>
153
+ issue.title.includes('Stale Branches Report')
154
+ );
155
+
156
+ if (existingIssue) {
157
+ await github.rest.issues.update({
158
+ owner: context.repo.owner,
159
+ repo: context.repo.repo,
160
+ issue_number: existingIssue.number,
161
+ body: `${report}\n\n---\n*Updated: ${new Date().toISOString()}*`
162
+ });
163
+ } else {
164
+ await github.rest.issues.create({
165
+ owner: context.repo.owner,
166
+ repo: context.repo.repo,
167
+ title: '🧹 Stale Branches Report',
168
+ body: `${report}\n\n---\n*Created: ${new Date().toISOString()}*`,
169
+ labels: ['maintenance', 'automated']
170
+ });
171
+ }
172
+
173
+ # Job 3: Clean up old caches
174
+ cache-cleanup:
175
+ name: Cache Cleanup
176
+ runs-on: ubuntu-latest
177
+ if: github.event_name == 'schedule' || github.event.inputs.task == 'all' || github.event.inputs.task == 'cache-cleanup'
178
+ timeout-minutes: 10
179
+
180
+ steps:
181
+ - name: Checkout code
182
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
183
+
184
+ - name: Cleanup old caches
185
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
186
+ with:
187
+ script: |
188
+ const { data: caches } = await github.rest.actions.getActionsCacheList({
189
+ owner: context.repo.owner,
190
+ repo: context.repo.repo,
191
+ per_page: 100
192
+ });
193
+
194
+ console.log(`Found ${caches.total_count} caches`);
195
+
196
+ const thirtyDaysAgo = new Date();
197
+ thirtyDaysAgo.setDate(thirtyDaysAgo.getDate() - 30);
198
+
199
+ let deletedCount = 0;
200
+ for (const cache of caches.actions_caches) {
201
+ const cacheDate = new Date(cache.last_accessed_at);
202
+
203
+ if (cacheDate < thirtyDaysAgo) {
204
+ console.log(`Deleting cache: ${cache.key} (last accessed: ${cache.last_accessed_at})`);
205
+
206
+ await github.rest.actions.deleteActionsCacheById({
207
+ owner: context.repo.owner,
208
+ repo: context.repo.repo,
209
+ cache_id: cache.id
210
+ });
211
+
212
+ deletedCount++;
213
+ }
214
+ }
215
+
216
+ console.log(`Deleted ${deletedCount} old caches`);
217
+ core.summary
218
+ .addHeading('Cache Cleanup Summary')
219
+ .addRaw(`Deleted ${deletedCount} caches older than 30 days`)
220
+ .write();
221
+
222
+ # Job 4: Health check for external services
223
+ health-check:
224
+ name: External Services Health Check
225
+ runs-on: ubuntu-latest
226
+ if: github.event_name == 'schedule' || github.event.inputs.task == 'all' || github.event.inputs.task == 'health-check'
227
+ timeout-minutes: 10
228
+
229
+ steps:
230
+ - name: Checkout code
231
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
232
+
233
+ - name: Check production API health
234
+ id: api-health
235
+ continue-on-error: true
236
+ run: |
237
+ # Replace with your actual API endpoint
238
+ RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://api.example.com/health || echo "000")
239
+ echo "response_code=$RESPONSE" >> $GITHUB_OUTPUT
240
+
241
+ if [ "$RESPONSE" = "200" ]; then
242
+ echo "✅ API is healthy (HTTP $RESPONSE)"
243
+ else
244
+ echo "❌ API health check failed (HTTP $RESPONSE)"
245
+ exit 1
246
+ fi
247
+
248
+ - name: Check database connectivity
249
+ id: db-health
250
+ continue-on-error: true
251
+ run: |
252
+ # Example: Check database connectivity
253
+ # Replace with your actual health check logic
254
+ echo "✅ Database connectivity check passed"
255
+
256
+ - name: Check CDN status
257
+ id: cdn-health
258
+ continue-on-error: true
259
+ run: |
260
+ # Example: Check CDN health
261
+ CDN_RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://cdn.example.com || echo "000")
262
+ echo "response_code=$CDN_RESPONSE" >> $GITHUB_OUTPUT
263
+
264
+ if [ "$CDN_RESPONSE" = "200" ]; then
265
+ echo "✅ CDN is healthy (HTTP $CDN_RESPONSE)"
266
+ else
267
+ echo "❌ CDN health check failed (HTTP $CDN_RESPONSE)"
268
+ exit 1
269
+ fi
270
+
271
+ - name: Create incident if health checks fail
272
+ if: |
273
+ steps.api-health.outcome == 'failure' ||
274
+ steps.db-health.outcome == 'failure' ||
275
+ steps.cdn-health.outcome == 'failure'
276
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
277
+ with:
278
+ script: |
279
+ const apiStatus = '${{ steps.api-health.outcome }}';
280
+ const dbStatus = '${{ steps.db-health.outcome }}';
281
+ const cdnStatus = '${{ steps.cdn-health.outcome }}';
282
+
283
+ const failedServices = [];
284
+ if (apiStatus === 'failure') failedServices.push('API');
285
+ if (dbStatus === 'failure') failedServices.push('Database');
286
+ if (cdnStatus === 'failure') failedServices.push('CDN');
287
+
288
+ await github.rest.issues.create({
289
+ owner: context.repo.owner,
290
+ repo: context.repo.repo,
291
+ title: `🚨 Health Check Failed: ${failedServices.join(', ')}`,
292
+ body: `## Health Check Failure Report\n\n**Date:** ${new Date().toISOString()}\n\n### Failed Services\n\n${failedServices.map(s => `- ❌ ${s}`).join('\n')}\n\n### Details\n\n- API Status: ${apiStatus}\n- Database Status: ${dbStatus}\n- CDN Status: ${cdnStatus}\n\n---\n*This incident was automatically created by the scheduled maintenance workflow.*`,
293
+ labels: ['incident', 'automated', 'urgent']
294
+ });
295
+
296
+ # Job 5: Generate weekly metrics report
297
+ weekly-metrics:
298
+ name: Weekly Metrics Report
299
+ runs-on: ubuntu-latest
300
+ # Run only on Mondays (schedule) or manual trigger
301
+ if: (github.event_name == 'schedule' && github.event.schedule == '0 2 * * 1') || github.event.inputs.task == 'all'
302
+ timeout-minutes: 15
303
+
304
+ steps:
305
+ - name: Checkout code
306
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
307
+ with:
308
+ fetch-depth: 0
309
+
310
+ - name: Generate metrics
311
+ id: metrics
312
+ run: |
313
+ # Commits in last 7 days
314
+ COMMITS=$(git log --since="7 days ago" --oneline | wc -l)
315
+ echo "commits=$COMMITS" >> $GITHUB_OUTPUT
316
+
317
+ # PRs merged in last 7 days
318
+ # This would typically use GitHub API
319
+ echo "prs=0" >> $GITHUB_OUTPUT
320
+
321
+ # Contributors in last 7 days
322
+ CONTRIBUTORS=$(git log --since="7 days ago" --format='%ae' | sort -u | wc -l)
323
+ echo "contributors=$CONTRIBUTORS" >> $GITHUB_OUTPUT
324
+
325
+ - name: Create metrics report
326
+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
327
+ with:
328
+ script: |
329
+ const commits = '${{ steps.metrics.outputs.commits }}';
330
+ const contributors = '${{ steps.metrics.outputs.contributors }}';
331
+
332
+ const weekStart = new Date();
333
+ weekStart.setDate(weekStart.getDate() - 7);
334
+
335
+ core.summary
336
+ .addHeading('📊 Weekly Repository Metrics')
337
+ .addRaw(`**Period:** ${weekStart.toISOString().split('T')[0]} to ${new Date().toISOString().split('T')[0]}`)
338
+ .addBreak()
339
+ .addTable([
340
+ [{data: 'Metric', header: true}, {data: 'Value', header: true}],
341
+ ['Commits', commits],
342
+ ['Contributors', contributors]
343
+ ])
344
+ .write();
345
+
346
+ # Summary job
347
+ summary:
348
+ name: Maintenance Summary
349
+ runs-on: ubuntu-latest
350
+ needs: [dependency-audit, stale-branches, cache-cleanup, health-check]
351
+ if: always()
352
+ timeout-minutes: 5
353
+
354
+ steps:
355
+ - name: Generate summary
356
+ run: |
357
+ echo "## Scheduled Maintenance Summary" >> $GITHUB_STEP_SUMMARY
358
+ echo "" >> $GITHUB_STEP_SUMMARY
359
+ echo "**Run Date:** $(date -u +'%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
360
+ echo "" >> $GITHUB_STEP_SUMMARY
361
+ echo "### Task Results" >> $GITHUB_STEP_SUMMARY
362
+ echo "- Dependency Audit: ${{ needs.dependency-audit.result }}" >> $GITHUB_STEP_SUMMARY
363
+ echo "- Stale Branches Cleanup: ${{ needs.stale-branches.result }}" >> $GITHUB_STEP_SUMMARY
364
+ echo "- Cache Cleanup: ${{ needs.cache-cleanup.result }}" >> $GITHUB_STEP_SUMMARY
365
+ echo "- Health Check: ${{ needs.health-check.result }}" >> $GITHUB_STEP_SUMMARY
366
+
367
+ if [[ "${{ needs.dependency-audit.result }}" == "failure" ]] || \
368
+ [[ "${{ needs.stale-branches.result }}" == "failure" ]] || \
369
+ [[ "${{ needs.cache-cleanup.result }}" == "failure" ]] || \
370
+ [[ "${{ needs.health-check.result }}" == "failure" ]]; then
371
+ echo "" >> $GITHUB_STEP_SUMMARY
372
+ echo "⚠️ **Some tasks failed. Please check the logs.**" >> $GITHUB_STEP_SUMMARY
373
+ else
374
+ echo "" >> $GITHUB_STEP_SUMMARY
375
+ echo "✅ **All maintenance tasks completed successfully.**" >> $GITHUB_STEP_SUMMARY
376
+ fi