bump-plugin-shas.yml 4.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. name: Bump Plugin SHAs
  2. # Nightly sweep: for each external entry whose upstream HEAD has moved past
  3. # its pinned SHA, validate at the new SHA with `claude plugin validate`
  4. # inline, then open one PR per bumped plugin on branch `bump/<slug>`.
  5. # Failing entries stay isolated in their own PR; passing bumps merge
  6. # independently.
  7. #
  8. # Bot-free — uses the default GITHUB_TOKEN. PRs opened with GITHUB_TOKEN don't
  9. # trigger on:pull_request workflows, so the required status checks on main
  10. # (`scan` from Scan Plugins, `check` from Check MCP URLs, `validate` from
  11. # Validate Plugins) would never run and the bump PR could never merge.
  12. # workflow_dispatch is exempt from that recursion guard, so we dispatch all
  13. # three ourselves against each per-entry bump branch after its PR is opened.
  14. # Each check run lands on the branch HEAD — the same SHA as the PR head — and
  15. # satisfies the corresponding required check. (Each of those workflows runs
  16. # its job unconditionally on workflow_dispatch, so a dispatch always reports.)
  17. #
  18. # max-bumps caps the per-night work for cost control. Per-entry scans are
  19. # more expensive than a single batched scan, so the cap is conservative.
  20. # The composite action skips entries that already have an open bump PR, so
  21. # re-dispatches don't pile up duplicate work.
  22. on:
  23. schedule:
  24. - cron: '23 7 * * *' # Daily 07:23 UTC
  25. workflow_dispatch:
  26. inputs:
  27. max_bumps:
  28. description: Cap on plugins bumped this run
  29. required: false
  30. default: '30'
  31. permissions:
  32. contents: write
  33. pull-requests: write
  34. actions: write # gh workflow run {scan-plugins,check-mcp-urls,validate-plugins}.yml per bump branch
  35. concurrency:
  36. group: bump-plugin-shas
  37. jobs:
  38. bump:
  39. runs-on: ubuntu-latest
  40. # Per-bump cost is ~2s (ls-remote + shallow clone + validate); 30 entries
  41. # is ~1-2 min. The 60 min ceiling absorbs slow upstreams without letting a
  42. # pathological run consume the default 360 min budget.
  43. timeout-minutes: 60
  44. steps:
  45. - uses: actions/checkout@v4
  46. # createCommitOnBranch-based bump so commits are signed by GitHub and
  47. # satisfy the org-level required_signatures ruleset on main.
  48. - uses: anthropics/claude-plugins-community/.github/actions/bump-plugin-shas@2324c6d8d9d8ceebc9bf253e5d683320dbf40760
  49. id: bump
  50. with:
  51. marketplace-path: .claude-plugin/marketplace.json
  52. max-bumps: ${{ inputs.max_bumps || '30' }}
  53. pr-mode: per-entry
  54. # Keep in sync with sha-exempt in validate-plugins.yml: names
  55. # listed there have no source.sha on purpose, so the nightly bump
  56. # must skip them instead of re-pinning them.
  57. sha-exempt: ""
  58. claude-cli-version: latest
  59. # Per-entry fan-out: dispatch the three required checks against each bump
  60. # branch. `pr-urls` is a JSON array of {name, old_sha, new_sha, branch,
  61. # pr_url} entries emitted by the composite action when pr-mode is
  62. # per-entry. All three (scan / check / validate) are required on main and
  63. # none fire on the GITHUB_TOKEN-opened PR, so each must be dispatched.
  64. # A single failed dispatch (transient API error / rate limit) must not
  65. # strand the remaining branches, so we attempt every dispatch, then fail
  66. # the step if any failed: a missing required check would otherwise leave
  67. # its bump PR silently blocked behind a green run, and the composite
  68. # action skips slugs with an open PR so it would never be retried.
  69. - name: Dispatch required checks per per-entry PR
  70. if: steps.bump.outputs.pr-urls != '' && steps.bump.outputs.pr-urls != '[]'
  71. env:
  72. GH_TOKEN: ${{ github.token }}
  73. PR_URLS: ${{ steps.bump.outputs.pr-urls }}
  74. run: |
  75. set -euo pipefail
  76. dispatch_failures="$(mktemp)"
  77. jq -c '.[]' <<<"$PR_URLS" | while read -r entry; do
  78. branch=$(jq -r '.branch' <<<"$entry")
  79. name=$(jq -r '.name' <<<"$entry")
  80. for wf in scan-plugins check-mcp-urls validate-plugins; do
  81. echo "Dispatching ${wf}.yml against $branch ($name)"
  82. if ! gh workflow run "${wf}.yml" --ref "$branch"; then
  83. echo "::error::Failed to dispatch ${wf}.yml against $branch ($name) — required check will be missing; re-dispatch with: gh workflow run ${wf}.yml --ref $branch"
  84. echo "${wf} ${branch}" >> "$dispatch_failures"
  85. fi
  86. done
  87. done
  88. if [ -s "$dispatch_failures" ]; then
  89. echo "::error::$(wc -l < "$dispatch_failures" | tr -d ' ') required-check dispatch(es) failed; the affected bump PR(s) are blocked until re-dispatched (see annotations above)."
  90. exit 1
  91. fi