Skip to content
This repository was archived by the owner on Apr 22, 2026. It is now read-only.

Commit f6e4662

Browse files
mediazoneclaude
andcommitted
feat: add workflow analysis and update suggestion tools
- Add analyze_workflow tool for version status reporting - Add suggest_updates tool for safe update recommendations - Add get_latest_in_major tool for staying within major versions - Add parse-workflow utility for YAML parsing - Extend parse-action with version comparison utilities - Update README with new tool documentation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent e720c97 commit f6e4662

6 files changed

Lines changed: 1464 additions & 10 deletions

File tree

README.md

Lines changed: 127 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ reference GitHub Actions by providing:
77
- Commit SHA retrieval for specific version tags
88
- Immutability status checking for releases
99
- Ready-to-use SHA-pinned references
10+
- **Workflow analysis** with update level detection (major/minor/patch)
11+
- **Safe update suggestions** that avoid breaking changes
1012

1113
## Why Use This?
1214

@@ -103,6 +105,9 @@ Once configured, ask Claude to look up GitHub Actions:
103105
- "Get the secure reference for actions/setup-node@v4"
104106
- "Check if actions/cache@v4.2.0 is immutable"
105107
- "List all versions of actions/upload-artifact"
108+
- "Analyze my workflow file for outdated actions"
109+
- "Suggest safe updates for my CI workflow"
110+
- "What's the latest v4.x version of actions/checkout?"
106111

107112
## Tool: `lookup_action`
108113

@@ -118,19 +123,131 @@ Once configured, ask Claude to look up GitHub Actions:
118123
```
119124
Action: actions/checkout
120125
121-
Latest Version: v4.2.2
122-
Commit SHA: 11bd71901bbe5b1630ceea73d27597364c9af683
123-
Immutable: Yes
124-
Published: 2024-10-23T14:05:06Z
126+
Latest Version: v6.0.1
127+
Commit SHA: 8e8c483db84b4bee98b60c0593521ed34d9990e8
128+
Immutable: No
129+
Published: 2025-12-02T16:38:59Z
125130
126131
Recommended Usage (SHA-pinned):
127-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
132+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
128133
129134
Security Notes:
130-
- This release is immutable - the tag and assets are protected from modification.
135+
- WARNING: This release is NOT immutable. The tag could potentially be moved to a different commit.
136+
- Using the SHA-pinned reference provides protection against tag tampering.
131137
- SHA-pinned references prevent supply chain attacks by ensuring you always use the exact same code.
132138
```
133139

140+
## Tool: `analyze_workflow`
141+
142+
Analyze a GitHub Actions workflow file and show version status for all actions.
143+
Reports current vs latest versions, update levels (major/minor/patch), and risk
144+
assessment.
145+
146+
### Parameters
147+
148+
| Parameter | Type | Required | Description |
149+
| ------------------ | ------- | -------- | ---------------------------------------------------- |
150+
| `workflow_content` | string | Yes | The workflow YAML content to analyze |
151+
| `only_updates` | boolean | No | Only show actions that need updates (default: false) |
152+
153+
### Example Output
154+
155+
```
156+
## Summary
157+
Total actions: 6
158+
Up to date: 1
159+
Major updates available: 2 ⚠️
160+
Minor updates available: 2
161+
Patch updates available: 1
162+
163+
## Actions
164+
165+
| Action | Current | Latest | Update | Risk |
166+
|--------|---------|--------|--------|------|
167+
| actions/checkout | v4.2.2 | v6.0.1 | ⚠️ Major | 🔴 High |
168+
| actions/setup-node | v4.1.0 | v6.2.0 | ⚠️ Major | 🔴 High |
169+
| docker/login-action | v3.3.0 | v3.6.0 | 📦 Minor | 🟡 Medium |
170+
| docker/build-push-action | v6.9.0 | v6.18.0 | 📦 Minor | 🟡 Medium |
171+
| appleboy/ssh-action | v1.2.0 | v1.2.4 | 🔧 Patch | 🟢 Low |
172+
173+
## Safe Updates (Minor/Patch)
174+
...
175+
176+
## Major Updates (Review Required)
177+
...
178+
```
179+
180+
## Tool: `suggest_updates`
181+
182+
Suggest safe updates for GitHub Actions in a workflow. Returns only safe updates
183+
(minor/patch) and suggestions to stay current within major versions.
184+
185+
### Parameters
186+
187+
| Parameter | Type | Required | Description |
188+
| ------------------ | ------ | -------- | ---------------------------------------------------------------------------- |
189+
| `workflow_content` | string | Yes | The workflow YAML content to analyze |
190+
| `risk_tolerance` | string | No | `"patch"` = only patches, `"minor"` = patch + minor (default), `"all"` = all |
191+
192+
### Example Output
193+
194+
```
195+
## Summary
196+
Total actions analyzed: 6
197+
Already up to date: 1
198+
Safe updates available: 3
199+
Actions with major updates: 2 (staying on current major)
200+
201+
## Safe Updates
202+
These updates are safe to apply:
203+
204+
### 📦 docker/login-action: v3.3.0 → v3.6.0
205+
Minor version update - new features, backwards compatible
206+
207+
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.6.0
208+
209+
### 🔧 appleboy/ssh-action: v1.2.0 → v1.2.4
210+
Patch version update - bug fixes only
211+
212+
uses: appleboy/ssh-action@2ead5e36573714d0d3cfcbac3646c3e0f09ec849 # v1.2.4
213+
214+
## Updates Within Current Major
215+
These actions have major updates available, but you can safely update within your current major version:
216+
217+
### actions/checkout: v4.2.2 → v4.2.2
218+
Safe update within v4.x (latest overall is v6.0.1)
219+
220+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
221+
```
222+
223+
## Tool: `get_latest_in_major`
224+
225+
Get the latest version of a GitHub Action within the same major version. Useful
226+
for safe updates that avoid breaking changes.
227+
228+
### Parameters
229+
230+
| Parameter | Type | Required | Description |
231+
| --------- | ------ | -------- | ------------------------------------------------------------------------ |
232+
| `action` | string | Yes | Action reference with version (e.g., `actions/checkout@v4` or `@v4.1.0`) |
233+
234+
### Example Output
235+
236+
```
237+
Action: actions/checkout
238+
Current Version: v4
239+
Major Version: v4
240+
241+
Latest in v4.x: v4.2.2
242+
Commit SHA: 11bd71901bbe5b1630ceea73d27597364c9af683
243+
Immutable: Yes
244+
245+
Note: Latest overall is v6.0.1
246+
247+
Recommended Usage (SHA-pinned):
248+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
249+
```
250+
134251
## Authentication
135252

136253
The service supports multiple authentication methods, checked in the following
@@ -252,10 +369,10 @@ When set, the service will:
252369
```
253370
Action: actions/checkout
254371
255-
Latest Version: v4.2.1
256-
Commit SHA: abc123...
257-
Immutable: Yes
258-
Published: 2024-10-15T10:00:00Z (7 days ago)
372+
Latest Version: v6.0.1
373+
Commit SHA: 8e8c483db84b4bee98b60c0593521ed34d9990e8
374+
Immutable: No
375+
Published: 2025-12-02T16:38:59Z (52 days ago)
259376
260377
Security Notes:
261378
- Minimum release age filter active: only considering releases at least 5 days old.

main.ts

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
99
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
1010
import { z } from "zod";
1111
import { formatResultAsText, lookupAction } from "./src/tools/lookup-action.ts";
12+
import {
13+
analyzeWorkflow,
14+
formatAnalyzeResultAsText,
15+
} from "./src/tools/analyze-workflow.ts";
16+
import {
17+
formatLatestInMajorAsText,
18+
formatSuggestUpdatesAsText,
19+
getLatestInMajorVersion,
20+
suggestUpdates,
21+
} from "./src/tools/suggest-updates.ts";
1222

1323
// Create the MCP server
1424
const server = new McpServer({
@@ -65,6 +75,144 @@ server.tool(
6575
},
6676
);
6777

78+
// Register the analyze_workflow tool
79+
server.tool(
80+
"analyze_workflow",
81+
"Analyze a GitHub Actions workflow file and show version status for all actions. " +
82+
"Reports current vs latest versions, update levels (major/minor/patch), and risk assessment.",
83+
{
84+
workflow_content: z
85+
.string()
86+
.describe("The workflow YAML content to analyze"),
87+
only_updates: z
88+
.boolean()
89+
.optional()
90+
.describe("Only show actions that need updates (default: false)"),
91+
},
92+
async ({ workflow_content, only_updates }) => {
93+
try {
94+
const result = await analyzeWorkflow({
95+
workflow_content,
96+
only_updates,
97+
});
98+
const text = formatAnalyzeResultAsText(result);
99+
100+
return {
101+
content: [
102+
{
103+
type: "text" as const,
104+
text,
105+
},
106+
],
107+
};
108+
} catch (error) {
109+
const message = error instanceof Error
110+
? error.message
111+
: "Unknown error occurred";
112+
return {
113+
content: [
114+
{
115+
type: "text" as const,
116+
text: `Error: ${message}`,
117+
},
118+
],
119+
isError: true,
120+
};
121+
}
122+
},
123+
);
124+
125+
// Register the suggest_updates tool
126+
server.tool(
127+
"suggest_updates",
128+
"Suggest safe updates for GitHub Actions in a workflow. " +
129+
"Returns only safe updates (minor/patch) and suggestions to stay current within major versions.",
130+
{
131+
workflow_content: z
132+
.string()
133+
.describe("The workflow YAML content to analyze"),
134+
risk_tolerance: z
135+
.enum(["patch", "minor", "all"])
136+
.optional()
137+
.describe(
138+
"Risk tolerance: 'patch' = only patches, 'minor' = patch + minor (default), 'all' = include major",
139+
),
140+
},
141+
async ({ workflow_content, risk_tolerance }) => {
142+
try {
143+
const result = await suggestUpdates({
144+
workflow_content,
145+
risk_tolerance,
146+
});
147+
const text = formatSuggestUpdatesAsText(result);
148+
149+
return {
150+
content: [
151+
{
152+
type: "text" as const,
153+
text,
154+
},
155+
],
156+
};
157+
} catch (error) {
158+
const message = error instanceof Error
159+
? error.message
160+
: "Unknown error occurred";
161+
return {
162+
content: [
163+
{
164+
type: "text" as const,
165+
text: `Error: ${message}`,
166+
},
167+
],
168+
isError: true,
169+
};
170+
}
171+
},
172+
);
173+
174+
// Register the get_latest_in_major tool
175+
server.tool(
176+
"get_latest_in_major",
177+
"Get the latest version of a GitHub Action within the same major version. " +
178+
"Useful for safe updates that avoid breaking changes.",
179+
{
180+
action: z
181+
.string()
182+
.describe(
183+
"Action reference with version, e.g., 'actions/checkout@v4' or 'actions/setup-node@v4.1.0'",
184+
),
185+
},
186+
async ({ action }) => {
187+
try {
188+
const result = await getLatestInMajorVersion({ action });
189+
const text = formatLatestInMajorAsText(result);
190+
191+
return {
192+
content: [
193+
{
194+
type: "text" as const,
195+
text,
196+
},
197+
],
198+
};
199+
} catch (error) {
200+
const message = error instanceof Error
201+
? error.message
202+
: "Unknown error occurred";
203+
return {
204+
content: [
205+
{
206+
type: "text" as const,
207+
text: `Error: ${message}`,
208+
},
209+
],
210+
isError: true,
211+
};
212+
}
213+
},
214+
);
215+
68216
// Start the server with stdio transport
69217
async function main() {
70218
const transport = new StdioServerTransport();

0 commit comments

Comments
 (0)