4646 repository : javaBin/platform
4747 token : ${{ steps.app-token.outputs.token }}
4848 ref : main
49- sparse-checkout : scripts/review-plan.py
49+ sparse-checkout : scripts
5050 path : platform
5151
5252 - name : Configure AWS credentials via OIDC
@@ -56,24 +56,13 @@ jobs:
5656 aws-region : ${{ inputs.aws_region }}
5757
5858 - name : Download plan text from S3
59- run : |
60- PREFIX=$(dirname "${{ inputs.plan_key }}")
61- aws s3 cp "s3://${PLAN_BUCKET}/${PREFIX}/plan-output.txt" plan-output.txt
59+ run : aws s3 cp "s3://${PLAN_BUCKET}/$(dirname "${{ inputs.plan_key }}")/plan-output.txt" plan-output.txt
6260
6361 - name : Run LLM review
6462 id : review
6563 env :
6664 REVIEW_RESULT_PATH : review-result.json
67- run : |
68- python3 platform/scripts/review-plan.py plan-output.txt 2>&1 | tee review-output.txt || true
69-
70- if [ -f review-result.json ]; then
71- RISK=$(python3 -c "import json; print(json.load(open('review-result.json')).get('risk', 'FAILED'))")
72- else
73- RISK="FAILED"
74- fi
75- echo "risk_level=${RISK}" >> "$GITHUB_OUTPUT"
76- echo "LLM review risk: ${RISK}"
65+ run : sh platform/scripts/extract-review-risk.sh platform/scripts/review-plan.py plan-output.txt
7766
7867 - name : Post review to PR
7968 if : github.event_name == 'pull_request'
@@ -110,40 +99,6 @@ jobs:
11099 body: body
111100 });
112101
113- - name : Post to Slack on direct push
114- if : github.event_name == 'push' && github.ref == 'refs/heads/main'
115- env :
116- GITHUB_RUN_URL : https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
117- run : |
118- export SLACK_WEBHOOK_URL=$(aws ssm get-parameter \
119- --name /javabin/slack/platform-resource-alerts-webhook \
120- --with-decryption --query Parameter.Value --output text)
121-
122- python3 << 'PYEOF'
123- import json, os, urllib.request
124- webhook_url = os.environ.get("SLACK_WEBHOOK_URL", "")
125- if not webhook_url:
126- print("No webhook URL, skipping Slack notification")
127- exit(0)
128- run_url = os.environ["GITHUB_RUN_URL"]
129- repo = os.environ.get("GITHUB_REPOSITORY", "unknown")
130- try:
131- with open("review-result.json") as f:
132- result = json.load(f)
133- risk = result.get("risk", "UNKNOWN")
134- summary = result.get("summary", "No summary")
135- except Exception:
136- risk = "FAILED"
137- summary = "Review failed"
138- emoji = {"LOW": "\U0001F7E2", "MEDIUM": "\U0001F7E1", "HIGH": "\U0001F534"}.get(risk, "\u26AA")
139- payload = json.dumps({
140- "blocks": [
141- {"type": "header", "text": {"type": "plain_text", "text": f"{emoji} Plan Review: {risk}", "emoji": True}},
142- {"type": "section", "text": {"type": "mrkdwn", "text": f"*Repo:* {repo}\n*Summary:* {summary}"}},
143- {"type": "section", "text": {"type": "mrkdwn", "text": f"<{run_url}|View Workflow Run>"}},
144- ],
145- "text": f"Plan review: {risk} for {repo}"
146- }).encode()
147- req = urllib.request.Request(webhook_url, data=payload, headers={"Content-Type": "application/json"})
148- urllib.request.urlopen(req)
149- PYEOF
102+ - name : Alert Slack on HIGH risk
103+ if : github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.review.outputs.risk_level == 'HIGH'
104+ run : sh platform/scripts/notify-high-risk.sh /javabin/slack/platform-override-alerts-webhook "https://github.com/javaBin/platform/actions/workflows/approve-override.yml"
0 commit comments