Skip to content

Commit d19fd78

Browse files
mvvmmBrunojoe1994
authored andcommitted
fix: add missing setup steps to bonk-auto-triage (cloudflare#30765)
* fix: add checkout step to bonk-auto-triage job * fix: add full setup steps to bonk-auto-triage to match bonk job * fix: remove unnecessary pnpm/node_modules setup from bonk jobs * fix: restore pnpm/node_modules setup to both bonk jobs * fix: use pull_request_target for auto-triage, checkout base ref, update comment * fix: revert to pull_request event, remove pull_request_target comment * chore: rename bonk-auto-triage to bonk-auto-review * fix: handle missing GH_ORG_TOKEN gracefully in check-codeowner
1 parent 76fd834 commit d19fd78

4 files changed

Lines changed: 58 additions & 28 deletions

File tree

.github/actions/check-codeowner/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "Check whether the event actor is listed in CODEOWNERS, including t
44
inputs:
55
GH_ORG_TOKEN:
66
description: "Token with read:org scope for resolving team membership"
7-
required: true
7+
required: false
88

99
outputs:
1010
is-codeowner:

.github/actions/check-codeowner/index.js

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/actions/check-codeowner/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,12 @@ async function isCodeowner(octokit: Octokit, actor: string): Promise<boolean> {
9393

9494
(async function () {
9595
try {
96-
const token = core.getInput("GH_ORG_TOKEN", { required: true });
96+
const token = core.getInput("GH_ORG_TOKEN");
97+
if (!token) {
98+
core.warning("GH_ORG_TOKEN not set — skipping CODEOWNERS check");
99+
core.setOutput("is-codeowner", "false");
100+
return;
101+
}
97102
const octokit = github.getOctokit(token);
98103

99104
const actor = getActor();

.github/workflows/bonk.yml

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,8 @@ jobs:
8989
mentions: "/bonk"
9090
permissions: CODEOWNERS
9191

92-
bonk-auto-triage:
92+
bonk-auto-review:
9393
needs: check-codeowner
94-
# pull_request (not pull_request_target) is used here — secrets are available
95-
# because this only runs on non-fork PRs (head.repo == base.repo). We do NOT
96-
# check out or execute the PR's code — Bonk reads context via the GitHub API only.
9794
if: |
9895
needs.check-codeowner.outputs.is-codeowner == 'true' &&
9996
github.event_name == 'pull_request' &&
@@ -107,7 +104,35 @@ jobs:
107104
issues: write
108105
pull-requests: write
109106
steps:
110-
- name: Run Lil Bonk (auto-triage)
107+
- name: Checkout repository
108+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
109+
with:
110+
fetch-depth: 1
111+
112+
- name: Set up pnpm
113+
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
114+
with:
115+
version: 10
116+
117+
- name: Setup Node.js
118+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
119+
id: setup-node
120+
with:
121+
node-version: 24.x
122+
cache: pnpm
123+
124+
- name: Restore node_modules (cache hit)
125+
id: node-modules-cache
126+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
127+
with:
128+
path: node_modules
129+
key: node-modules-${{ runner.os }}-node-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('package.json') }}
130+
131+
- name: Install node_modules (cache miss)
132+
run: pnpm install --frozen-lockfile
133+
if: steps.node-modules-cache.outputs.cache-hit != 'true'
134+
135+
- name: Run Lil Bonk (auto-review)
111136
uses: ask-bonk/ask-bonk/github@main
112137
env:
113138
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_AI_GATEWAY_ACCOUNT_ID }}
@@ -119,7 +144,7 @@ jobs:
119144
permissions: CODEOWNERS
120145
token_permissions: NO_PUSH
121146
prompt: |
122-
Triage this pull request. Review the title, description, and diff.
147+
Review this pull request. Review the title, description, and diff.
123148
Apply appropriate labels, summarize what the PR changes, and flag
124149
any issues that need attention from a maintainer (e.g. missing
125150
description, broken links, incorrect frontmatter, style guide

0 commit comments

Comments
 (0)