@@ -119,3 +119,62 @@ jobs:
119119 enable_mention_detection : false
120120 secrets :
121121 ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
122+
123+ # Rollback safety analysis — runs on every PR push
124+ claude-rollback-safety-check :
125+ needs : security-check
126+ # Cancel in-progress check when a new push arrives — always analyze latest state
127+ concurrency :
128+ group : claude-rollback-${{ github.event.pull_request.number }}
129+ cancel-in-progress : true
130+ if : |
131+ needs.security-check.outputs.authorized == 'true' &&
132+ github.event_name == 'pull_request'
133+ permissions :
134+ contents : write
135+ id-token : write
136+ pull-requests : write
137+ issues : write
138+ uses : dotCMS/ai-workflows/.github/workflows/claude-orchestrator.yml@v2.0.0
139+ with :
140+ trigger_mode : automatic
141+ prompt : |
142+ You are a dotCMS rollback-safety analyst. Determine whether the changes in this PR are safe to roll back to the previous release.
143+
144+ STEP 1 — Read the rollback-unsafe categories reference:
145+ cat docs/core/ROLLBACK_UNSAFE_CATEGORIES.md
146+
147+ STEP 2 — Get the full PR diff:
148+ git diff ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }}
149+
150+ STEP 3 — Analyze the diff against EVERY category in the reference document.
151+ Focus on: database migrations (runonce tasks), Elasticsearch mapping changes,
152+ data model changes, API contract changes, and any structural storage changes.
153+ Ignore pure UI, test-only, or documentation changes unless they touch an unsafe category.
154+
155+ STEP 4a — If the changes match one or more unsafe categories, post this comment on the PR
156+ using: gh pr comment ${{ github.event.pull_request.number }} --body "..."
157+
158+ Format:
159+ Pull Request Unsafe to Rollback!!!
160+ - Category: <category ID and name, e.g. "C-1 — Structural Data Model Change">
161+ - Risk Level: <🔴 CRITICAL / 🟠 HIGH / 🟡 MEDIUM / 🟢 LOW>
162+ - Why it's unsafe: <specific explanation tied to the actual code changed>
163+ - Code that makes it unsafe: <file path(s) and the specific lines or block>
164+ - Alternative (if possible): <the safer alternative from the reference, adapted to this change>
165+
166+ If multiple categories match, repeat the block for each one.
167+
168+ Then add the label: gh pr edit ${{ github.event.pull_request.number }} --add-label "AI: Not Safe To Rollback"
169+
170+ STEP 4b — If the changes do NOT match any unsafe category:
171+ Only add the label: gh pr edit ${{ github.event.pull_request.number }} --add-label "AI: Safe To Rollback"
172+ No comment needed.
173+
174+ Be specific: quote actual file names and code lines, not generic descriptions.
175+ claude_args : ' --allowedTools "Bash(git diff*),Bash(git log*),Bash(cat docs/core/ROLLBACK_UNSAFE_CATEGORIES.md),Bash(gh pr comment*),Bash(gh pr edit*)"'
176+ timeout_minutes : 15
177+ runner : ubuntu-latest
178+ enable_mention_detection : false
179+ secrets :
180+ ANTHROPIC_API_KEY : ${{ secrets.ANTHROPIC_API_KEY }}
0 commit comments