Skip to content

Commit db9e873

Browse files
authored
Consume shared Shadow bot engine instead of vendored copy (#277)
Replace the vendored scripts/issue_bot/ bot with a thin caller of the reusable sudsali/shadow workflow (SHA-pinned), matching what awslabs/deequ now does. This kills the code drift between per-repo vendored copies and upgrades PR review from the legacy single-pass path to the 3-agent Investigator/Critic/Reporter pipeline. - .github/workflows/issue-bot.yml: caller of sudsali/shadow@54ec94e - .shadow.yml: PyDeequ codebase config; bot.name kept as deequ-bot so the existing auto-approve.yml clean-marker grep keeps matching - remove vendored scripts/issue_bot/ and its tests/test_bot.py - update-kb.yml: drop stale paths-ignore for the deleted bot dir
1 parent 2e628b2 commit db9e873

18 files changed

Lines changed: 54 additions & 2666 deletions

.github/workflows/base.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646
pip install poetry==1.7.1
4747
poetry install
4848
poetry run pip install pyspark==$SPARK_VERSION
49-
poetry run python -m pytest -s tests --ignore=tests/test_bot.py
49+
poetry run python -m pytest -s tests

.github/workflows/issue-bot.yml

Lines changed: 33 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: PyDeequ Bot
1+
name: PyDeequ Bot # load-bearing: auto-approve.yml keys on this exact name
2+
# To upgrade the engine, bump the SHA in BOTH `uses:` and `shadow_ref` below
3+
# (GitHub forbids expressions in `uses:`, so they can't share a variable).
24

35
on:
46
issues:
57
types: [opened, reopened]
6-
pull_request_target: # Runs base branch code with secrets; safe because bot fetches diff via API, never executes PR code. NEVER add ref: to checkout.
8+
pull_request_target: # base-branch checkout only; never add ref: (see SECURITY A1)
79
types: [opened, reopened, synchronize]
810
issue_comment:
911
types: [created]
@@ -17,114 +19,41 @@ on:
1719
type: boolean
1820
default: true
1921

20-
# Serialize per issue/PR to prevent duplicate comments
22+
# Union of the reusable workflow's nested-job permissions; a caller must grant
23+
# these or the call fails at startup (each nested job still narrows its own set).
24+
permissions:
25+
contents: read
26+
id-token: write
27+
pull-requests: write
28+
issues: write
29+
30+
# inputs.issue_number fallback: workflow_dispatch has no event PR/issue number.
2131
concurrency:
2232
group: bot-${{ github.event.issue.number || github.event.pull_request.number || inputs.issue_number }}
2333
cancel-in-progress: false
2434

2535
jobs:
26-
analyze:
27-
runs-on: ubuntu-latest
28-
timeout-minutes: 10
36+
shadow:
37+
# Avoid self-triggered loops (bot's own comments) and double-reviewing a PR
38+
# from both issue_comment and pull_request_target; dispatch is always manual.
2939
if: >-
3040
(github.event_name == 'workflow_dispatch') ||
3141
(github.actor != 'github-actions[bot]' &&
3242
(github.event.issue.pull_request == null || github.event_name == 'pull_request_target'))
33-
permissions:
34-
contents: read
35-
id-token: write
36-
37-
steps:
38-
- name: Checkout repository
39-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
40-
with:
41-
persist-credentials: false
42-
43-
- name: Configure AWS credentials
44-
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
45-
with:
46-
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
47-
aws-region: us-east-1
48-
49-
- name: Set up Python
50-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
51-
with:
52-
python-version: "3.12"
53-
54-
- name: Install dependencies
55-
run: pip install requests==2.33.1 boto3==1.42.94
56-
57-
- name: Run analysis
58-
env:
59-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60-
GITHUB_REPOSITORY: ${{ github.repository }}
61-
ISSUE_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number || inputs.issue_number }}
62-
EVENT_TYPE: ${{ github.event_name }}
63-
EVENT_ACTION: ${{ github.event.action }}
64-
EVENT_BEFORE: ${{ github.event.before }}
65-
EVENT_AFTER: ${{ github.event.pull_request.head.sha || github.event.after }}
66-
GITHUB_ACTOR: ${{ github.actor }}
67-
KB_S3_BUCKET: ${{ secrets.KB_S3_BUCKET }}
68-
KB_S3_KEY: ${{ secrets.KB_S3_KEY }}
69-
BEDROCK_MODEL_ID: ${{ secrets.BEDROCK_MODEL_ID }}
70-
GUARDRAIL_ID: ${{ secrets.GUARDRAIL_ID }}
71-
GUARDRAIL_VERSION: ${{ secrets.GUARDRAIL_VERSION }}
72-
SM_ISSUE_CLASSIFY_PROMPT: pydeequ-bot/issue-classify-prompt
73-
SM_ISSUE_RESPOND_PROMPT: pydeequ-bot/issue-respond-prompt
74-
SM_PR_FILE_REVIEW_PROMPT: pydeequ-bot/pr-file-review-prompt
75-
SM_FOLLOWUP_PROMPT: pydeequ-bot/followup-prompt
76-
CODEBASE_SRC_DIR: pydeequ
77-
CODEBASE_FILE_EXT: .py
78-
DRY_RUN: ${{ inputs.dry_run || 'false' }}
79-
ARTIFACT_PATH: ${{ runner.temp }}/bot_result.json
80-
run: python -m issue_bot.main analyze
81-
working-directory: scripts
82-
83-
- name: Upload artifact
84-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
85-
with:
86-
name: bot-result
87-
path: ${{ runner.temp }}/bot_result.json
88-
retention-days: 30
89-
90-
act:
91-
runs-on: ubuntu-latest
92-
timeout-minutes: 1
93-
needs: analyze
94-
permissions:
95-
contents: read
96-
issues: write
97-
pull-requests: write
98-
99-
steps:
100-
- name: Checkout repository
101-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
102-
with:
103-
persist-credentials: false
104-
105-
- name: Set up Python
106-
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
107-
with:
108-
python-version: "3.12"
109-
110-
- name: Install dependencies
111-
run: pip install requests==2.33.1 boto3==1.42.94
112-
113-
- name: Download artifact
114-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
115-
with:
116-
name: bot-result
117-
path: ${{ runner.temp }}
118-
119-
- name: Execute actions
120-
env:
121-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122-
GITHUB_REPOSITORY: ${{ github.repository }}
123-
ISSUE_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number || inputs.issue_number }}
124-
EVENT_TYPE: ${{ github.event_name }}
125-
EVENT_ACTION: ${{ github.event.action }}
126-
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
127-
DRY_RUN: ${{ inputs.dry_run || 'false' }}
128-
ARTIFACT_PATH: ${{ runner.temp }}/bot_result.json
129-
run: python -m issue_bot.main act
130-
working-directory: scripts
43+
uses: sudsali/shadow/.github/workflows/shadow-review.yml@54ec94e0ca8c90d9b58ff95a2a06b175a115784e
44+
with:
45+
pr_number: ${{ inputs.issue_number }}
46+
dry_run: ${{ inputs.dry_run && 'true' || 'false' }}
47+
shadow_ref: 54ec94e0ca8c90d9b58ff95a2a06b175a115784e
48+
aws_region: us-east-1
49+
prompt_sm_prefix: pydeequ-bot
50+
secrets:
51+
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }}
52+
GUARDRAIL_ID: ${{ secrets.GUARDRAIL_ID }}
53+
GUARDRAIL_VERSION: ${{ secrets.GUARDRAIL_VERSION }}
54+
KB_S3_BUCKET: ${{ secrets.KB_S3_BUCKET }}
55+
KB_S3_KEY: ${{ secrets.KB_S3_KEY }}
56+
BEDROCK_MODEL_ID: ${{ secrets.BEDROCK_MODEL_ID }}
57+
BEDROCK_REPORTER_MODEL_ID: ${{ vars.BEDROCK_REPORTER_MODEL_ID }}
58+
BEDROCK_CRITIC_MODEL_ID: ${{ vars.BEDROCK_CRITIC_MODEL_ID }}
59+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/update-kb.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ on:
55
branches: [master]
66
paths-ignore:
77
- '.github/workflows/**'
8-
- 'scripts/issue_bot/**'
9-
- 'tests/test_bot.py'
108
workflow_dispatch:
119

1210
jobs:

.shadow.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Shadow engine config for awslabs/python-deequ.
2+
3+
codebase:
4+
src_dir: pydeequ
5+
file_ext: .py
6+
test_dir: tests
7+
language: python
8+
9+
bot:
10+
name: deequ-bot # not pydeequ-bot: must render the <!-- deequ-bot:clean --> marker auto-approve.yml greps for
11+
attribution: "Reviewed by Shadow · github.com/sudsali/shadow"
12+
escalate_label: needs-human
13+
max_replies: 2
14+
max_runs_per_hour: 20
15+
16+
models:
17+
investigator: us.anthropic.claude-opus-4-7
18+
critic: us.anthropic.claude-opus-4-7
19+
reporter: us.anthropic.claude-haiku-4-5-20251001-v1:0
20+
issue: us.anthropic.claude-sonnet-4-6

scripts/issue_bot/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/issue_bot/__init__.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

scripts/issue_bot/bedrock_client.py

Lines changed: 0 additions & 105 deletions
This file was deleted.

scripts/issue_bot/config.py

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)