agentics-maintenance.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. # ___ _ _
  2. # / _ \ | | (_)
  3. # | |_| | __ _ ___ _ __ | |_ _ ___
  4. # | _ |/ _` |/ _ \ '_ \| __| |/ __|
  5. # | | | | (_| | __/ | | | |_| | (__
  6. # \_| |_/\__, |\___|_| |_|\__|_|\___|
  7. # __/ |
  8. # _ _ |___/
  9. # | | | | / _| |
  10. # | | | | ___ _ __ _ __| |_| | _____ ____
  11. # | |/\| |/ _ \ '__| |/ /| _| |/ _ \ \ /\ / / ___|
  12. # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \
  13. # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/
  14. #
  15. # This file was automatically generated by pkg/workflow/maintenance_workflow.go (v0.68.3). DO NOT EDIT.
  16. #
  17. # To regenerate this workflow, run:
  18. # gh aw compile
  19. # Not all edits will cause changes to this file.
  20. #
  21. # For more information: https://github.github.com/gh-aw/introduction/overview/
  22. #
  23. # Alternative regeneration methods:
  24. # make recompile
  25. #
  26. # Or use the gh-aw CLI directly:
  27. # ./gh-aw compile --validate --verbose
  28. #
  29. # The workflow is generated when any workflow uses the 'expires' field
  30. # in create-discussions, create-issues, or create-pull-request safe-outputs configuration.
  31. # Schedule frequency is automatically determined by the shortest expiration time.
  32. #
  33. name: Agentic Maintenance
  34. on:
  35. schedule:
  36. - cron: "37 0 * * *" # Daily (based on minimum expires: 30 days)
  37. workflow_dispatch:
  38. inputs:
  39. operation:
  40. description: 'Optional maintenance operation to run'
  41. required: false
  42. type: choice
  43. default: ''
  44. options:
  45. - ''
  46. - 'disable'
  47. - 'enable'
  48. - 'update'
  49. - 'upgrade'
  50. - 'safe_outputs'
  51. - 'create_labels'
  52. - 'clean_cache_memories'
  53. - 'validate'
  54. run_url:
  55. description: 'Run URL or run ID to replay safe outputs from (e.g. https://github.com/owner/repo/actions/runs/12345 or 12345). Required when operation is safe_outputs.'
  56. required: false
  57. type: string
  58. default: ''
  59. workflow_call:
  60. inputs:
  61. operation:
  62. description: 'Optional maintenance operation to run (disable, enable, update, upgrade, safe_outputs, create_labels, clean_cache_memories, validate)'
  63. required: false
  64. type: string
  65. default: ''
  66. run_url:
  67. description: 'Run URL or run ID to replay safe outputs from (e.g. https://github.com/owner/repo/actions/runs/12345 or 12345). Required when operation is safe_outputs.'
  68. required: false
  69. type: string
  70. default: ''
  71. outputs:
  72. operation_completed:
  73. description: 'The maintenance operation that was completed (empty when none ran or a scheduled job ran)'
  74. value: ${{ jobs.run_operation.outputs.operation || inputs.operation }}
  75. applied_run_url:
  76. description: 'The run URL that safe outputs were applied from'
  77. value: ${{ jobs.apply_safe_outputs.outputs.run_url }}
  78. permissions: {}
  79. jobs:
  80. close-expired-entities:
  81. if: ${{ (!(github.event.repository.fork)) && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '') }}
  82. runs-on: ubuntu-slim
  83. permissions:
  84. discussions: write
  85. issues: write
  86. pull-requests: write
  87. steps:
  88. - name: Setup Scripts
  89. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  90. with:
  91. destination: ${{ runner.temp }}/gh-aw/actions
  92. - name: Close expired discussions
  93. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  94. with:
  95. script: |
  96. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  97. setupGlobals(core, github, context, exec, io, getOctokit);
  98. const { main } = require('${{ runner.temp }}/gh-aw/actions/close_expired_discussions.cjs');
  99. await main();
  100. - name: Close expired issues
  101. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  102. with:
  103. script: |
  104. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  105. setupGlobals(core, github, context, exec, io, getOctokit);
  106. const { main } = require('${{ runner.temp }}/gh-aw/actions/close_expired_issues.cjs');
  107. await main();
  108. - name: Close expired pull requests
  109. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  110. with:
  111. script: |
  112. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  113. setupGlobals(core, github, context, exec, io, getOctokit);
  114. const { main } = require('${{ runner.temp }}/gh-aw/actions/close_expired_pull_requests.cjs');
  115. await main();
  116. cleanup-cache-memory:
  117. if: ${{ (!(github.event.repository.fork)) && (github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' || inputs.operation == '' || inputs.operation == 'clean_cache_memories') }}
  118. runs-on: ubuntu-slim
  119. permissions:
  120. actions: write
  121. steps:
  122. - name: Setup Scripts
  123. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  124. with:
  125. destination: ${{ runner.temp }}/gh-aw/actions
  126. - name: Cleanup outdated cache-memory entries
  127. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  128. with:
  129. script: |
  130. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  131. setupGlobals(core, github, context, exec, io, getOctokit);
  132. const { main } = require('${{ runner.temp }}/gh-aw/actions/cleanup_cache_memory.cjs');
  133. await main();
  134. run_operation:
  135. if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation != '' && inputs.operation != 'safe_outputs' && inputs.operation != 'create_labels' && inputs.operation != 'clean_cache_memories' && inputs.operation != 'validate' && (!(github.event.repository.fork)) }}
  136. runs-on: ubuntu-slim
  137. permissions:
  138. actions: write
  139. contents: write
  140. pull-requests: write
  141. outputs:
  142. operation: ${{ steps.record.outputs.operation }}
  143. steps:
  144. - name: Checkout repository
  145. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  146. with:
  147. persist-credentials: false
  148. - name: Setup Scripts
  149. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  150. with:
  151. destination: ${{ runner.temp }}/gh-aw/actions
  152. - name: Check admin/maintainer permissions
  153. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  154. with:
  155. github-token: ${{ secrets.GITHUB_TOKEN }}
  156. script: |
  157. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  158. setupGlobals(core, github, context, exec, io, getOctokit);
  159. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs');
  160. await main();
  161. - name: Install gh-aw
  162. uses: github/gh-aw-actions/setup-cli@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  163. with:
  164. version: v0.68.3
  165. - name: Run operation
  166. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  167. env:
  168. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  169. GH_AW_OPERATION: ${{ inputs.operation }}
  170. GH_AW_CMD_PREFIX: gh aw
  171. with:
  172. github-token: ${{ secrets.GITHUB_TOKEN }}
  173. script: |
  174. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  175. setupGlobals(core, github, context, exec, io, getOctokit);
  176. const { main } = require('${{ runner.temp }}/gh-aw/actions/run_operation_update_upgrade.cjs');
  177. await main();
  178. - name: Record outputs
  179. id: record
  180. run: echo "operation=${{ inputs.operation }}" >> "$GITHUB_OUTPUT"
  181. apply_safe_outputs:
  182. if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'safe_outputs' && (!(github.event.repository.fork)) }}
  183. runs-on: ubuntu-slim
  184. permissions:
  185. actions: read
  186. contents: write
  187. discussions: write
  188. issues: write
  189. pull-requests: write
  190. outputs:
  191. run_url: ${{ steps.record.outputs.run_url }}
  192. steps:
  193. - name: Checkout actions folder
  194. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  195. with:
  196. sparse-checkout: |
  197. actions
  198. persist-credentials: false
  199. - name: Setup Scripts
  200. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  201. with:
  202. destination: ${{ runner.temp }}/gh-aw/actions
  203. - name: Check admin/maintainer permissions
  204. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  205. with:
  206. github-token: ${{ secrets.GITHUB_TOKEN }}
  207. script: |
  208. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  209. setupGlobals(core, github, context, exec, io, getOctokit);
  210. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs');
  211. await main();
  212. - name: Apply Safe Outputs
  213. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  214. env:
  215. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  216. GH_AW_RUN_URL: ${{ inputs.run_url }}
  217. with:
  218. github-token: ${{ secrets.GITHUB_TOKEN }}
  219. script: |
  220. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  221. setupGlobals(core, github, context, exec, io, getOctokit);
  222. const { main } = require('${{ runner.temp }}/gh-aw/actions/apply_safe_outputs_replay.cjs');
  223. await main();
  224. - name: Record outputs
  225. id: record
  226. run: echo "run_url=${{ inputs.run_url }}" >> "$GITHUB_OUTPUT"
  227. create_labels:
  228. if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'create_labels' && (!(github.event.repository.fork)) }}
  229. runs-on: ubuntu-slim
  230. permissions:
  231. contents: read
  232. issues: write
  233. steps:
  234. - name: Checkout repository
  235. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  236. with:
  237. persist-credentials: false
  238. - name: Setup Scripts
  239. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  240. with:
  241. destination: ${{ runner.temp }}/gh-aw/actions
  242. - name: Check admin/maintainer permissions
  243. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  244. with:
  245. github-token: ${{ secrets.GITHUB_TOKEN }}
  246. script: |
  247. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  248. setupGlobals(core, github, context, exec, io, getOctokit);
  249. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs');
  250. await main();
  251. - name: Install gh-aw
  252. uses: github/gh-aw-actions/setup-cli@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  253. with:
  254. version: v0.68.3
  255. - name: Create missing labels
  256. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  257. env:
  258. GH_AW_CMD_PREFIX: gh aw
  259. with:
  260. github-token: ${{ secrets.GITHUB_TOKEN }}
  261. script: |
  262. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  263. setupGlobals(core, github, context, exec, io, getOctokit);
  264. const { main } = require('${{ runner.temp }}/gh-aw/actions/create_labels.cjs');
  265. await main();
  266. validate_workflows:
  267. if: ${{ (github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_call') && inputs.operation == 'validate' && (!(github.event.repository.fork)) }}
  268. runs-on: ubuntu-latest
  269. permissions:
  270. contents: read
  271. issues: write
  272. steps:
  273. - name: Checkout repository
  274. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  275. with:
  276. persist-credentials: false
  277. - name: Setup Scripts
  278. uses: github/gh-aw-actions/setup@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  279. with:
  280. destination: ${{ runner.temp }}/gh-aw/actions
  281. - name: Check admin/maintainer permissions
  282. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  283. with:
  284. github-token: ${{ secrets.GITHUB_TOKEN }}
  285. script: |
  286. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  287. setupGlobals(core, github, context, exec, io, getOctokit);
  288. const { main } = require('${{ runner.temp }}/gh-aw/actions/check_team_member.cjs');
  289. await main();
  290. - name: Install gh-aw
  291. uses: github/gh-aw-actions/setup-cli@ba90f2186d7ad780ec640f364005fa24e797b360 # v0.68.3
  292. with:
  293. version: v0.68.3
  294. - name: Validate workflows and file issue on findings
  295. uses: actions/github-script@373c709c69115d41ff229c7e5df9f8788daa9553 # v9
  296. env:
  297. GH_AW_CMD_PREFIX: gh aw
  298. with:
  299. github-token: ${{ secrets.GITHUB_TOKEN }}
  300. script: |
  301. const { setupGlobals } = require('${{ runner.temp }}/gh-aw/actions/setup_globals.cjs');
  302. setupGlobals(core, github, context, exec, io, getOctokit);
  303. const { main } = require('${{ runner.temp }}/gh-aw/actions/run_validate_workflows.cjs');
  304. await main();