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