|
1 | | -name: Deequ Bot |
2 | | -# NOTE: the workflow name "Deequ Bot" is load-bearing — auto-approve.yml keys |
3 | | -# on workflows: ["Java CI with Maven", "Deequ Bot"]. Do not rename without |
4 | | -# updating auto-approve.yml. |
5 | | -# |
6 | | -# This repo consumes the shared Shadow engine (sudsali/shadow) instead of a |
7 | | -# vendored copy of the bot. Deequ's language-tuned prompts live in Secrets |
8 | | -# Manager under the `deequ-bot/*` namespace and are selected via |
9 | | -# `prompt_sm_prefix` — the engine fetches them in place of its bundled |
10 | | -# language-agnostic defaults, so behavior stays deequ-specific while the code |
11 | | -# is shared. All four surfaces (PR review, issue triage, issue-respond, |
12 | | -# follow-up) run from one engine. |
13 | | -# |
14 | | -# UPGRADING the engine: bump the SHA in **two** places below — the `uses:` ref |
15 | | -# (which resolves the reusable *workflow file*) AND the `shadow_ref` input |
16 | | -# (which the workflow uses to check out the engine *code*). They MUST match, or |
17 | | -# the workflow definition runs against a different code revision than intended. |
18 | | -# GitHub Actions forbids expressions in `uses:`, so they can't share one |
19 | | -# variable — both are pinned to SHADOW_ENGINE_SHA below. That is the ONLY change |
20 | | -# needed per upgrade: the GitHubActionsDeequBot IAM trust (once the optional |
21 | | -# hardening is applied POST-MERGE) pins job_workflow_ref to |
22 | | -# `sudsali/shadow/.github/workflows/shadow-review.yml@*` (version wildcard), so |
23 | | -# no IAM/Admin change is required per upgrade. |
24 | | -# |
25 | | -# SHADOW_ENGINE_SHA = 3a057597420d7123df162bfe4686aaafb5f7eccd (tag v1.2) |
26 | | -# ^ keep the two occurrences below identical to this value. |
| 1 | +name: Deequ 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). |
27 | 4 |
|
28 | 5 | on: |
29 | 6 | issues: |
30 | 7 | types: [opened, reopened] |
31 | | - pull_request_target: # Runs base branch code with secrets; safe because the bot fetches the 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) |
32 | 9 | types: [opened, reopened, synchronize] |
33 | 10 | issue_comment: |
34 | 11 | types: [created] |
|
42 | 19 | type: boolean |
43 | 20 | default: true |
44 | 21 |
|
45 | | -# Reusable-workflow permission ceiling: a called workflow's nested jobs can |
46 | | -# only receive permissions the CALLER grants. This block is the UNION the |
47 | | -# reusable workflow's two jobs need — analyze (contents:read, id-token:write, |
48 | | -# pull-requests:read) and act (contents:read, issues:write, pull-requests:write). |
49 | | -# Without it the token defaults to none and the call fails at startup with |
50 | | -# "is requesting '...', but is only allowed 'none'". GitHub still applies each |
51 | | -# nested job's own narrower per-job permissions, so this ceiling doesn't widen |
52 | | -# what analyze/act can actually do. |
| 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). |
53 | 24 | permissions: |
54 | 25 | contents: read |
55 | 26 | id-token: write |
56 | 27 | pull-requests: write |
57 | 28 | issues: write |
58 | 29 |
|
59 | | -# Serialize per issue/PR to prevent duplicate comments. (The reusable workflow |
60 | | -# also sets its own concurrency group; this caller-side group additionally |
61 | | -# covers the workflow_dispatch path via inputs.issue_number.) |
| 30 | +# Also covers the workflow_dispatch path, which has no PR/issue number in context. |
62 | 31 | concurrency: |
63 | 32 | group: bot-${{ github.event.issue.number || github.event.pull_request.number || inputs.issue_number }} |
64 | 33 | cancel-in-progress: false |
65 | 34 |
|
66 | 35 | jobs: |
67 | 36 | shadow: |
68 | | - # Preserve the vendored bot's trigger guard exactly: run on workflow_dispatch; |
69 | | - # otherwise skip bot-authored events and skip issue_comment on PRs (PR review |
70 | | - # comes through pull_request_target, not issue_comment on the PR's issue). |
71 | | - # The engine also skips bot authors internally (author_is_bot SKIP), but |
72 | | - # gating here avoids spinning up the reusable workflow at all. |
| 37 | + # Skip bot-authored events and issue_comment on PRs (PR review runs via |
| 38 | + # pull_request_target); always run on manual dispatch. |
73 | 39 | if: >- |
74 | 40 | (github.event_name == 'workflow_dispatch') || |
75 | 41 | (github.actor != 'github-actions[bot]' && |
76 | 42 | (github.event.issue.pull_request == null || github.event_name == 'pull_request_target')) |
77 | 43 | uses: sudsali/shadow/.github/workflows/shadow-review.yml@3a057597420d7123df162bfe4686aaafb5f7eccd |
78 | 44 | with: |
79 | | - # PR/issue number for the workflow_dispatch path (push/PR events resolve |
80 | | - # it inside the reusable workflow from the event payload). |
81 | 45 | pr_number: ${{ inputs.issue_number }} |
82 | 46 | dry_run: ${{ inputs.dry_run && 'true' || 'false' }} |
83 | 47 | shadow_ref: 3a057597420d7123df162bfe4686aaafb5f7eccd |
84 | 48 | aws_region: us-east-1 |
85 | | - # Deequ's language-tuned prompts. The engine expands this to all eight |
86 | | - # SM secret names under deequ-bot/ (pr-investigator/critic/reporter + |
87 | | - # 2 commit nudges + issue-classify/issue-respond/followup). These already |
88 | | - # exist in Secrets Manager from the prior vendored deployment. |
89 | 49 | prompt_sm_prefix: deequ-bot |
90 | 50 | secrets: |
91 | 51 | AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }} |
|
94 | 54 | KB_S3_BUCKET: ${{ secrets.KB_S3_BUCKET }} |
95 | 55 | KB_S3_KEY: ${{ secrets.KB_S3_KEY }} |
96 | 56 | BEDROCK_MODEL_ID: ${{ secrets.BEDROCK_MODEL_ID }} |
97 | | - # Reporter/critic model IDs were repo VARIABLES in the vendored setup; a |
98 | | - # var can feed a secret input, so reference them here. Both are optional: |
99 | | - # if unset (empty), the engine's config falls back to its defaults — |
100 | | - # reporter → Haiku, critic → the investigator model (Opus). Matches the |
101 | | - # vendored bot's behavior; no functional change if either var is unset. |
| 57 | + # Repo variables (not secrets); empty falls back to engine defaults. |
102 | 58 | BEDROCK_REPORTER_MODEL_ID: ${{ vars.BEDROCK_REPORTER_MODEL_ID }} |
103 | 59 | BEDROCK_CRITIC_MODEL_ID: ${{ vars.BEDROCK_CRITIC_MODEL_ID }} |
104 | 60 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
0 commit comments