You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: address PR review feedback for token optimizer workflows
- Replace schedule: daily with workflow_run trigger (runs after
analyzer completes, not before)
- Add branches: [main] restriction for security
- Fix no-report path to avoid creating blocking labeled issues
(prevents skip-if-match from permanently blocking future runs)
- Add workflow name resolution from display names to file paths
(handles mismatch between report display names and file stems)
- Add || true to grep commands to prevent false failures on
no matches
- Use -h flag on grep for cleaner multi-file output
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: .github/workflows/claude-token-optimizer.md
+37-21Lines changed: 37 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,10 @@
1
1
---
2
2
description: Daily Claude token optimization advisor — reads the latest token usage report and creates actionable recommendations to reduce token consumption for the most expensive workflow
@@ -42,7 +45,7 @@ gh issue list --repo "$GITHUB_REPOSITORY" \
42
45
--json number,title,body,createdAt,url
43
46
```
44
47
45
-
If no report exists, create a brief issue stating that no token usage report was found and that the `claude-token-usage-analyzer` workflow should run first. Then stop.
48
+
If no report exists, do **not** create an issue. Simply log a message noting that no token usage report was found and that the `claude-token-usage-analyzer` workflow should run first. Then stop without calling any safe-output tools.
46
49
47
50
Read the full issue body to extract per-workflow statistics.
48
51
@@ -63,10 +66,18 @@ Extract these key metrics for the target workflow:
63
66
64
67
## Step 3: Analyze the Workflow Definition
65
68
66
-
Read the workflow's `.md` source file to understand its configuration:
69
+
Resolve the workflow file name from the display name in the report. The report table uses display names (e.g., "Smoke Claude") but the files use kebab-case (e.g., `smoke-claude.md`). Map the name by searching for a matching `name:` field:
67
70
68
71
```bash
69
-
cat ".github/workflows/<workflow-name>.md"
72
+
# Find workflow file by display name
73
+
DISPLAY_NAME="Smoke Claude"# from report
74
+
WORKFLOW_FILE=$(grep -rl "^name: ${DISPLAY_NAME}$" .github/workflows/*.md 2>/dev/null | head -1)
0 commit comments