Skip to content

Commit deca9a1

Browse files
Test core ai rollback labeler (#438)
### Proposed Changes * change 1 * change 2 ### Checklist - [ ] Tests - [ ] Translations - [ ] Security Implications Contemplated (add notes if applicable) ### Additional Info ** any additional useful context or info ** ### Screenshots Original | Updated :-------------------------:|:-------------------------: ** original screenshot ** | ** updated screenshot **
1 parent 2155851 commit deca9a1

3 files changed

Lines changed: 602 additions & 0 deletions

File tree

.github/workflows/ai_claude-orchestrator.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 }}

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ When editing ANY code, improve incrementally:
7878
- [CI/CD Pipeline](docs/core/CICD_PIPELINE.md) — Build process, testing, deployment
7979
- [Security Principles](docs/core/SECURITY_PRINCIPLES.md) — Input validation, secrets, logging
8080
- [GitHub Issue Management](docs/core/GITHUB_ISSUE_MANAGEMENT.md) — Issues, PRs, epics
81+
- [Rollback-Unsafe Change Categories](docs/core/ROLLBACK_UNSAFE_CATEGORIES.md) — DB schema, ES mapping, API contract risks
8182

8283
### Backend Development (Java/Maven)
8384
- [Java Standards](docs/backend/JAVA_STANDARDS.md) — Coding patterns, immutables, exceptions, utilities

0 commit comments

Comments
 (0)