Skip to content

Commit 576c43d

Browse files
authored
Merge pull request #489 from authzed/suggestion-workflow-improvements
Suggestion workflow improvements
2 parents 7dca186 + 711ebce commit 576c43d

3 files changed

Lines changed: 64 additions & 12 deletions

File tree

.github/workflows/cla.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: "CLA"
3-
on: # yamllint disable-line rule:truthy
3+
"on":
44
issue_comment:
55
types:
66
- "created"

.github/workflows/claude-code-review.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ name: "Claude Code Review"
33

44
"on":
55
pull_request:
6-
types: ["opened", "synchronize", "ready_for_review", "reopened", "labeled", "edited"]
7-
# Optional: Only run on specific file changes
8-
# paths:
9-
# - "src/**/*.ts"
10-
# - "src/**/*.tsx"
11-
# - "src/**/*.js"
12-
# - "src/**/*.jsx"
6+
types:
7+
["opened", "synchronize", "ready_for_review", "reopened", "labeled", "edited"]
8+
# Optional: Only run on specific file changes
9+
# paths:
10+
# - "src/**/*.ts"
11+
# - "src/**/*.tsx"
12+
# - "src/**/*.js"
13+
# - "src/**/*.jsx"
1314

1415
jobs:
1516
claude-review:

.github/workflows/claude.yml

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ jobs:
5959

6060
suggestion:
6161
name: "Suggestion Handler"
62+
concurrency:
63+
group: "doc-suggestion-${{ github.event.issue.number || inputs.issue_number }}"
64+
cancel-in-progress: false
6265
if: |
6366
(github.event_name == 'issues' &&
6467
github.event.action == 'labeled' &&
@@ -93,13 +96,14 @@ jobs:
9396
# Configured to give 50 turns to claude based on observations. This can be increased if we observe sessions failing to complete
9497
- name: "Run Claude Code for Suggestion"
9598
id: "claude-suggestion"
99+
timeout-minutes: 30
96100
uses: "anthropics/claude-code-action@v1"
97101
env:
98102
ISSUE_NUMBER: "${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}"
99103
with:
100104
anthropic_api_key: "${{ secrets.ANTHROPIC_API_KEY }}"
101-
# Enabling this may expose secrets. Do not set to true on public repos
102-
# https://github.com/anthropics/claude-code-action/blob/main/docs/security.md#%EF%B8%8F-full-output-security-warning
105+
# Full output may expose secrets - do not enable on public repos
106+
# See: https://github.com/anthropics/claude-code-action/blob/main/docs/security.md
103107
show_full_output: false
104108
prompt: |
105109
Read the repository documentation structure and the issue description for issue #${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}.
@@ -118,11 +122,58 @@ jobs:
118122
7. Push your branch to origin using: git push -u origin <branch-name>
119123
8. Post a comment to issue #${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }} with:
120124
- Summary of changes made
125+
- Highlight any actions attempted but did not have access to complete
121126
- Link to create a PR using: https://github.com/${{ github.repository }}/compare/<branch-name>?expand=1
122127
Use the gh CLI: gh issue comment ${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }} --body "<your comment>"
123128
124-
Focus only on documentation changes. Make app changes necessary to support the documentation such as adding visual components, icons, and structure.
125-
Otherwise, do not modify application code, configuration files, or CI/CD workflows.
129+
RESTRICTIONS:
130+
- Only modify documentation files (.mdx, .md) in app/
131+
- Only modify _meta.ts for navigation entries
132+
- May add components to components/ for documentation display
133+
- NEVER modify .github/, scripts/, or root config files (package.json, next.config.mjs, etc.)
134+
- If the request is out of scope, comment explaining why
126135
claude_args: |
127136
--allowedTools "Read,Write,Edit,Bash(git:*),Bash(gh:*),WebFetch(domain:authzed.com)"
128137
--max-turns 50
138+
139+
- name: "Notify on failure"
140+
if: "failure()"
141+
continue-on-error: true
142+
env:
143+
GH_TOKEN: "${{ github.token }}"
144+
ISSUE_NUMBER: "${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}"
145+
RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
146+
run: |
147+
# Don't fail if notification fails
148+
gh issue comment "$ISSUE_NUMBER" --body "## Documentation Workflow Failed
149+
150+
The automated documentation workflow encountered an error and could not complete.
151+
152+
**Workflow run**: $RUN_URL
153+
154+
A maintainer will investigate. You can also check the workflow logs for details.
155+
156+
---
157+
*Automated notification from GitHub Actions*" || echo "::warning::Failed to post failure notification"
158+
159+
- name: "Notify on timeout/cancel"
160+
if: "cancelled()"
161+
continue-on-error: true
162+
env:
163+
GH_TOKEN: "${{ github.token }}"
164+
ISSUE_NUMBER: "${{ github.event_name == 'workflow_dispatch' && inputs.issue_number || github.event.issue.number }}"
165+
RUN_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
166+
run: |
167+
gh issue comment "$ISSUE_NUMBER" --body "## Documentation Workflow Cancelled/Timed Out
168+
169+
The workflow was cancelled or timed out after 30 minutes.
170+
171+
**Possible causes:**
172+
- Request is too complex (try breaking into smaller issues)
173+
- Claude encountered a difficult decision
174+
- External service was slow to respond
175+
176+
**Workflow run**: $RUN_URL
177+
178+
---
179+
*Automated notification from GitHub Actions*" || echo "::warning::Failed to post timeout notification"

0 commit comments

Comments
 (0)