bump-plugin-shas.yml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. plugin:
  32. description: >-
  33. Bump ONLY this plugin name (exact entry name; empty = all stale). A
  34. frozen/sha-exempt target is still skipped (same as a full run).
  35. required: false
  36. default: ''
  37. permissions:
  38. contents: write
  39. pull-requests: write
  40. actions: write # gh workflow run {scan-plugins,check-mcp-urls,validate-plugins}.yml per bump branch
  41. concurrency:
  42. group: bump-plugin-shas
  43. jobs:
  44. bump:
  45. runs-on: ubuntu-latest
  46. # Per-bump cost is ~2s (ls-remote + shallow clone + validate); 30 entries
  47. # is ~1-2 min. The 60 min ceiling absorbs slow upstreams without letting a
  48. # pathological run consume the default 360 min budget.
  49. timeout-minutes: 60
  50. steps:
  51. - uses: actions/checkout@v4
  52. # createCommitOnBranch-based bump so commits are signed by GitHub and
  53. # satisfy the org-level required_signatures ruleset on main.
  54. - uses: anthropics/claude-plugins-community/.github/actions/bump-plugin-shas@9247660a88cf3f49456a2f6464d66fe4ea4f4a77
  55. id: bump
  56. with:
  57. marketplace-path: .claude-plugin/marketplace.json
  58. max-bumps: ${{ inputs.max_bumps || '30' }}
  59. only: ${{ inputs.plugin }}
  60. pr-mode: per-entry
  61. # Entries listed in .github/bump-tracking.json {"releases-only": [...]}
  62. # bump to the latest published release tag's commit instead of HEAD
  63. # (no release / not-ahead / lookup failure -> pin held; see the action
  64. # README). All other entries HEAD-track exactly as before.
  65. tracking-config: .github/bump-tracking.json
  66. claude-cli-version: latest
  67. # Per-entry fan-out: dispatch the three required checks against each bump
  68. # branch. `pr-urls` is a JSON array of {name, old_sha, new_sha, branch,
  69. # pr_url} entries emitted by the composite action when pr-mode is
  70. # per-entry. All three (scan / check / validate) are required on main and
  71. # none fire on the GITHUB_TOKEN-opened PR, so each must be dispatched.
  72. # A single failed dispatch (transient API error / rate limit) must not
  73. # strand the remaining branches, so we attempt every dispatch, then fail
  74. # the step if any failed: a missing required check would otherwise leave
  75. # its bump PR silently blocked behind a green run, and the composite
  76. # action skips slugs with an open PR so it would never be retried.
  77. - name: Dispatch required checks per per-entry PR
  78. if: steps.bump.outputs.pr-urls != '' && steps.bump.outputs.pr-urls != '[]'
  79. env:
  80. GH_TOKEN: ${{ github.token }}
  81. PR_URLS: ${{ steps.bump.outputs.pr-urls }}
  82. run: |
  83. set -euo pipefail
  84. dispatch_failures="$(mktemp)"
  85. jq -c '.[]' <<<"$PR_URLS" | while read -r entry; do
  86. branch=$(jq -r '.branch' <<<"$entry")
  87. name=$(jq -r '.name' <<<"$entry")
  88. for wf in scan-plugins check-mcp-urls validate-plugins; do
  89. echo "Dispatching ${wf}.yml against $branch ($name)"
  90. if ! gh workflow run "${wf}.yml" --ref "$branch"; then
  91. 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"
  92. echo "${wf} ${branch}" >> "$dispatch_failures"
  93. fi
  94. done
  95. done
  96. if [ -s "$dispatch_failures" ]; then
  97. 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)."
  98. exit 1
  99. fi