-
-
Notifications
You must be signed in to change notification settings - Fork 28
161 lines (142 loc) · 9.21 KB
/
Copy pathclaude.yml
File metadata and controls
161 lines (142 loc) · 9.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
# issues trigger removed with the triage job — re-add if the triage job is restored.
schedule:
- cron: '0 13 * * 1' # Mondays at 13:00 UTC (9 AM EDT / 8 AM EST)
workflow_dispatch:
jobs:
claude:
if: >
(github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment')
&& contains(github.event.comment.body, '@claude')
&& (github.event.comment.author_association == 'OWNER'
|| github.event.comment.author_association == 'MEMBER'
|| github.event.comment.author_association == 'COLLABORATOR')
permissions:
contents: write
id-token: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.3
- uses: anthropics/claude-code-action@v1.0.150
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: "--model claude-opus-4-7"
# Disabled 2026-05-14: the triage bot gave a user damaging advice on #894
# (suggested clearing site data, which wiped their IndexedDB save backups).
# Re-enable only after the prompt is hardened against destructive suggestions.
# triage:
# if: github.event_name == 'issues' && github.event.action == 'opened'
# permissions:
# contents: read
# id-token: write
# issues: write
# runs-on: ubuntu-latest
# steps:
# - uses: anthropics/claude-code-action@v1.0.150
# with:
# claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
# settings: |
# {
# "permissions": {
# "allow": ["Bash"],
# "deny": []
# }
# }
# prompt: |
# You are a triage assistant for PKMDS, a Pokémon save file editor built with Blazor WebAssembly using PKHeX.Core (https://github.com/codemonkey85/PKMDS-Blazor).
#
# Issue number: ${{ github.event.issue.number }}
# Issue title: ${{ github.event.issue.title }}
#
# Fetch the full issue body with:
# gh issue view ${{ github.event.issue.number }} --json title,body,author,labels
#
# Review the title and body, then take one of the following actions. Post comments with `gh issue comment ${{ github.event.issue.number }} --body "..."` and apply labels with `gh issue edit ${{ github.event.issue.number }} --add-label "<label>"`.
#
# ## Immediate close candidates — respond and apply the "invalid" or "wontfix" label if applicable:
#
# - **ROM hacks / fan-made games**: PKHeX.Core does not support ROM hacks or fan-made games. Politely explain this limitation and suggest the user check if there is a PKHeX plugin for their specific ROM hack.
# - **Save states**: The app only supports actual save files (.sav, .dsv, .bin, etc.), not emulator save states (.state, .ss0, etc.). Explain the distinction and ask the user to export an actual save file from their emulator.
# - **ROM files**: If the user is trying to load a ROM rather than a save file, clarify that the app edits save files, not ROMs.
# - **Feature already exists**: If the feature being requested clearly already exists in the app, point the user to where it is.
# - **Duplicate**: If this is clearly a duplicate of a known issue, say so and reference the other issue if you can identify it.
#
# ## Request more information — ask for specifics if the issue lacks enough detail to investigate:
#
# Required information for a bug report:
# - Which game title (e.g. Pokémon Scarlet, Sword, etc.)
# - What they were doing when the issue occurred
# - What happened vs. what they expected
# - Whether the save file is from a retail game or a ROM (and if ROM, which emulator)
# - Browser and OS, if relevant to a display or loading issue
# - Any specific Pokémon, move, item, or field involved
#
# If any of this is missing and the issue seems like a genuine bug, ask for the missing details in a friendly tone.
#
# ## No action needed — if the issue is clear, well-described, and appears to be a valid bug or reasonable feature request, simply post a brief acknowledgment that it has been received and will be reviewed. Do not over-triage valid issues.
#
# Always be friendly, helpful, and concise. Do not close issues yourself — only apply labels and post comments.
changelog:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read
discussions: write
id-token: write
steps:
- uses: actions/checkout@v6.0.3
with:
fetch-depth: 0
- uses: anthropics/claude-code-action@v1.0.150
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
settings: |
{
"permissions": {
"allow": ["Bash"],
"deny": []
}
}
prompt: |
You are generating a weekly changelog for PKMDS, a Pokémon save file editor at https://github.com/codemonkey85/PKMDS-Blazor.
Step 1: Find the date of the most recent "Change Log" discussion. First get the category ID:
GH_TOKEN=$PKMDS_DISCUSSION_TOKEN gh api graphql -f query='{ repository(owner: "codemonkey85", name: "PKMDS-Blazor") { discussionCategories(first: 20) { nodes { id name } } } }'
Find the ID for the category named "Change Log", then fetch the most recent discussion in that category:
GH_TOKEN=$PKMDS_DISCUSSION_TOKEN gh api graphql -f query='{ repository(owner: "codemonkey85", name: "PKMDS-Blazor") { discussions(first: 1, categoryId: "<CHANGE_LOG_CATEGORY_ID>", orderBy: {field: CREATED_AT, direction: DESC}) { nodes { createdAt title } } } }'
If a discussion is found, extract its `createdAt` timestamp (ISO 8601) and use it as the `--since` value in Step 2. If no discussion is found, fall back to `--since="7 days ago"`.
Step 2: Run this command to get commits since the last changelog entry (excluding merges):
git log --since="<DATE_FROM_STEP_1>" --no-merges --pretty=format:"%s"
Step 3: If there are no commits, stop — do not create a discussion.
Step 4: Write a short, friendly changelog aimed at end users (not developers). Focus on what changed for them:
- New features or tools
- Bug fixes and improvements
- Anything that affects how they use the app
Omit: dependency bumps, CI/CD changes, code formatting, internal refactors with no user-visible effect.
IMPORTANT — scope and attribution: "PKMDS" is the Blazor WebAssembly web app, and that is the product this changelog is about. The repo also contains separate native companion tools — the Windows Explorer preview/thumbnail handlers and the macOS/iOS Quick Look preview/thumbnail extensions. Those read PKHeX files from the filesystem and do NOT integrate with the web app. Do not describe their changes as features of PKMDS or imply they are part of the web app. If you mention them at all, clearly frame them as separate native/desktop companion tools (e.g. "Separately, the Windows file preview tool…"). When in doubt about whether a change affects the web app, leave it out.
Use plain language. Avoid jargon. Group related changes if it helps readability. Keep it concise.
Format the body as Markdown. Start with a brief intro line, then a bulleted list of changes.
Step 5: Determine today's date and format it as "Week of Month D, YYYY" (e.g. "Week of March 24, 2025") for the discussion title.
Step 6: Find the "Change Log" discussion category ID by running:
GH_TOKEN=$PKMDS_DISCUSSION_TOKEN gh api graphql -f query='{ repository(owner: "codemonkey85", name: "PKMDS-Blazor") { discussionCategories(first: 20) { nodes { id name } } } }'
To get the repository ID, run:
GH_TOKEN=$PKMDS_DISCUSSION_TOKEN gh api graphql -f query='{ repository(owner: "codemonkey85", name: "PKMDS-Blazor") { id } }'
Step 7: Create a new discussion using GraphQL variables so the body is passed cleanly.
Write the body to a temp file first, then pass it via a shell variable to avoid quoting issues:
printf '%s' "BODY_CONTENT" > /tmp/changelog_body.txt
GH_TOKEN=$PKMDS_DISCUSSION_TOKEN gh api graphql \
-f query='mutation($repositoryId: ID!, $categoryId: ID!, $title: String!, $body: String!) { createDiscussion(input: { repositoryId: $repositoryId, categoryId: $categoryId, title: $title, body: $body }) { discussion { url } } }' \
-f repositoryId="REPO_ID" \
-f categoryId="CATEGORY_ID" \
-f title="TITLE" \
-F body=@/tmp/changelog_body.txt
Post the discussion URL as a final output message.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PKMDS_DISCUSSION_TOKEN: ${{ secrets.DISCUSSION_TOKEN }}