Skip to content

Commit 2f972ba

Browse files
authored
Consolidate scripts and automate report management (#1540)
* removing old scripts * consolidated folder * Updating usage of scripts * Adding script to generate an open PR report, rather than making AI gen it each time * Adding step to close old quality report discussions
1 parent f7a7ef7 commit 2f972ba

9 files changed

Lines changed: 409 additions & 321 deletions

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
run: npm run build
4444

4545
- name: Fix line endings
46-
run: bash scripts/fix-line-endings.sh
46+
run: bash eng/fix-line-endings.sh
4747

4848
- name: Publish to main
4949
run: |

.github/workflows/skill-quality-report.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,84 @@ jobs:
297297
}
298298
core.setOutput('comment_count', String(commentParts.length));
299299
300+
- name: Close old report discussions
301+
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
302+
with:
303+
script: |
304+
const RETENTION_DAYS = 5;
305+
const CATEGORY_NAME = 'Skill Quality Reports';
306+
const TITLE_PREFIX = 'Skill Quality Report — ';
307+
308+
const cutoff = new Date();
309+
cutoff.setUTCDate(cutoff.getUTCDate() - RETENTION_DAYS);
310+
311+
let after = null;
312+
let closedCount = 0;
313+
let reachedCutoff = false;
314+
315+
while (!reachedCutoff) {
316+
const result = await github.graphql(`
317+
query($owner: String!, $repo: String!, $after: String) {
318+
repository(owner: $owner, name: $repo) {
319+
discussions(first: 100, after: $after, orderBy: { field: CREATED_AT, direction: ASC }) {
320+
nodes {
321+
id
322+
title
323+
createdAt
324+
closed
325+
url
326+
category {
327+
name
328+
}
329+
}
330+
pageInfo {
331+
hasNextPage
332+
endCursor
333+
}
334+
}
335+
}
336+
}
337+
`, {
338+
owner: context.repo.owner,
339+
repo: context.repo.repo,
340+
after,
341+
});
342+
343+
const discussions = result.repository.discussions;
344+
345+
for (const discussion of discussions.nodes) {
346+
if (new Date(discussion.createdAt) >= cutoff) {
347+
reachedCutoff = true;
348+
break;
349+
}
350+
351+
if (discussion.category?.name !== CATEGORY_NAME) continue;
352+
if (!discussion.title.startsWith(TITLE_PREFIX)) continue;
353+
if (discussion.closed) continue;
354+
355+
await github.graphql(`
356+
mutation($discussionId: ID!) {
357+
closeDiscussion(input: { discussionId: $discussionId }) {
358+
discussion {
359+
id
360+
}
361+
}
362+
}
363+
`, { discussionId: discussion.id });
364+
365+
closedCount++;
366+
console.log(`Closed old report discussion: ${discussion.url}`);
367+
}
368+
369+
if (reachedCutoff || !discussions.pageInfo.hasNextPage) {
370+
break;
371+
}
372+
373+
after = discussions.pageInfo.endCursor;
374+
}
375+
376+
console.log(`Closed ${closedCount} report discussion(s) older than ${RETENTION_DAYS} days.`);
377+
300378
# ── Create Discussion (preferred) or Issue (fallback) ────────
301379
- name: Create Discussion
302380
id: create-discussion

AGENTS.md

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,21 @@ npm run skill:create -- --name <skill-name>
5757

5858
All agent files (`*.agent.md`) and instruction files (`*.instructions.md`) must include proper markdown front matter. Agent Skills are folders containing a `SKILL.md` file with frontmatter and optional bundled assets. Hooks are folders containing a `README.md` with frontmatter and a `hooks.json` configuration file:
5959

60-
#### Agent Files (*.agent.md)
60+
#### Agent Files (\*.agent.md)
61+
6162
- Must have `description` field (wrapped in single quotes)
6263
- File names should be lower case with words separated by hyphens
6364
- Recommended to include `tools` field
6465
- Strongly recommended to specify `model` field
6566

66-
#### Instruction Files (*.instructions.md)
67+
#### Instruction Files (\*.instructions.md)
68+
6769
- Must have `description` field (wrapped in single quotes, not empty)
6870
- Must have `applyTo` field specifying file patterns (e.g., `'**.js, **.ts'`)
6971
- File names should be lower case with words separated by hyphens
7072

71-
#### Agent Skills (skills/*/SKILL.md)
73+
#### Agent Skills (skills/\*/SKILL.md)
74+
7275
- Each skill is a folder containing a `SKILL.md` file
7376
- SKILL.md must have `name` field (lowercase with hyphens, matching folder name, max 64 characters)
7477
- SKILL.md must have `description` field (wrapped in single quotes, 10-1024 characters)
@@ -78,7 +81,8 @@ All agent files (`*.agent.md`) and instruction files (`*.instructions.md`) must
7881
- Asset files should be reasonably sized (under 5MB per file)
7982
- Skills follow the [Agent Skills specification](https://agentskills.io/specification)
8083

81-
#### Hook Folders (hooks/*/README.md)
84+
#### Hook Folders (hooks/\*/README.md)
85+
8286
- Each hook is a folder containing a `README.md` file with frontmatter
8387
- README.md must have `name` field (human-readable name)
8488
- README.md must have `description` field (wrapped in single quotes, not empty)
@@ -89,7 +93,8 @@ All agent files (`*.agent.md`) and instruction files (`*.instructions.md`) must
8993
- Follow the [GitHub Copilot hooks specification](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/use-hooks)
9094
- Optionally includes `tags` field for categorization
9195

92-
#### Workflow Files (workflows/*.md)
96+
#### Workflow Files (workflows/\*.md)
97+
9398
- Each workflow is a standalone `.md` file in the `workflows/` directory
9499
- Must have `name` field (human-readable name)
95100
- Must have `description` field (wrapped in single quotes, not empty)
@@ -98,7 +103,8 @@ All agent files (`*.agent.md`) and instruction files (`*.instructions.md`) must
98103
- Only `.md` files are accepted — `.yml`, `.yaml`, and `.lock.yml` files are blocked by CI
99104
- Follow the [GitHub Agentic Workflows specification](https://github.github.com/gh-aw/reference/workflow-structure/)
100105

101-
#### Plugin Folders (plugins/*)
106+
#### Plugin Folders (plugins/\*)
107+
102108
- Each plugin is a folder containing a `.github/plugin/plugin.json` file with metadata
103109
- plugin.json must have `name` field (matching the folder name)
104110
- plugin.json must have `description` field (describing the plugin's purpose)
@@ -112,12 +118,14 @@ All agent files (`*.agent.md`) and instruction files (`*.instructions.md`) must
112118
When adding a new agent, instruction, skill, hook, workflow, or plugin:
113119

114120
**For Agents and Instructions:**
121+
115122
1. Create the file with proper front matter
116123
2. Add the file to the appropriate directory
117124
3. Update the README.md by running: `npm run build`
118125
4. Verify the resource appears in the generated README
119126

120127
**For Hooks:**
128+
121129
1. Create a new folder in `hooks/` with a descriptive name
122130
2. Create `README.md` with proper frontmatter (name, description, hooks, tags)
123131
3. Create `hooks.json` with hook configuration following GitHub Copilot hooks spec
@@ -126,16 +134,16 @@ When adding a new agent, instruction, skill, hook, workflow, or plugin:
126134
6. Update the README.md by running: `npm run build`
127135
7. Verify the hook appears in the generated README
128136

129-
130137
**For Workflows:**
138+
131139
1. Create a new `.md` file in `workflows/` with a descriptive name (e.g., `daily-issues-report.md`)
132140
2. Include frontmatter with `name` and `description`, plus agentic workflow fields (`on`, `permissions`, `safe-outputs`)
133141
3. Compile with `gh aw compile --validate` to verify it's valid
134142
4. Update the README.md by running: `npm run build`
135143
5. Verify the workflow appears in the generated README
136144

137-
138145
**For Skills:**
146+
139147
1. Run `npm run skill:create` to scaffold a new skill folder
140148
2. Edit the generated SKILL.md file with your instructions
141149
3. Add any bundled assets (scripts, templates, data) to the skill folder
@@ -144,6 +152,7 @@ When adding a new agent, instruction, skill, hook, workflow, or plugin:
144152
6. Verify the skill appears in the generated README
145153

146154
**For Plugins:**
155+
147156
1. Run `npm run plugin:create -- --name <plugin-name>` to scaffold a new plugin
148157
2. Define agents, commands, and skills in `plugin.json` using Claude Code spec fields
149158
3. Edit the generated `plugin.json` with your metadata
@@ -152,6 +161,7 @@ When adding a new agent, instruction, skill, hook, workflow, or plugin:
152161
6. Verify the plugin appears in `.github/plugin/marketplace.json`
153162

154163
**For External Plugins:**
164+
155165
1. Edit `plugins/external.json` and add an entry with `name`, `source`, `description`, and `version`
156166
2. The `source` field should be an object specifying a GitHub repo, git URL, npm package, or pip package (see [CONTRIBUTING.md](CONTRIBUTING.md#adding-external-plugins))
157167
3. Run `npm run build` to regenerate marketplace.json
@@ -168,25 +178,28 @@ npm run skill:validate
168178
npm run build
169179

170180
# Fix line endings (required before committing)
171-
bash scripts/fix-line-endings.sh
181+
bash eng/fix-line-endings.sh
172182
```
173183

174184
Before committing:
185+
175186
- Ensure all markdown front matter is correctly formatted
176187
- Verify file names follow the lower-case-with-hyphens convention
177188
- Run `npm run build` to update the README
178-
- **Always run `bash scripts/fix-line-endings.sh`** to normalize line endings (CRLF → LF)
189+
- **Always run `bash eng/fix-line-endings.sh`** to normalize line endings (CRLF → LF)
179190
- Check that your new resource appears correctly in the README
180191

181192
## Code Style Guidelines
182193

183194
### Markdown Files
195+
184196
- Use proper front matter with required fields
185197
- Keep descriptions concise and informative
186198
- Wrap description field values in single quotes
187199
- Use lower-case file names with hyphens as separators
188200

189201
### JavaScript/Node.js Scripts
202+
190203
- Located in `eng/` and `scripts/` directories
191204
- Follow Node.js ES module conventions (`.mjs` extension)
192205
- Use clear, descriptive function and variable names
@@ -201,37 +214,41 @@ When creating a pull request:
201214
2. **Front matter validation**: Ensure all markdown files have the required front matter fields
202215
3. **File naming**: Verify all new files follow the lower-case-with-hyphens naming convention
203216
4. **Build check**: Run `npm run build` before committing to verify README generation
204-
5. **Line endings**: **Always run `bash scripts/fix-line-endings.sh`** to normalize line endings to LF (Unix-style)
217+
5. **Line endings**: **Always run `bash eng/fix-line-endings.sh`** to normalize line endings to LF (Unix-style)
205218
6. **Description**: Provide a clear description of what your agent/instruction does
206219
7. **Testing**: If adding a plugin, run `npm run plugin:validate` to ensure validity
207220

208221
### Pre-commit Checklist
209222

210223
Before submitting your PR, ensure you have:
224+
211225
- [ ] Run `npm install` (or `npm ci`) to install dependencies
212226
- [ ] Run `npm run build` to generate the updated README.md
213-
- [ ] Run `bash scripts/fix-line-endings.sh` to normalize line endings
227+
- [ ] Run `bash eng/fix-line-endings.sh` to normalize line endings
214228
- [ ] Verified that all new files have proper front matter
215229
- [ ] Tested that your contribution works with GitHub Copilot
216230
- [ ] Checked that file names follow the naming convention
217231

218232
### Code Review Checklist
219233

220-
For instruction files (*.instructions.md):
234+
For instruction files (\*.instructions.md):
235+
221236
- [ ] Has markdown front matter
222237
- [ ] Has non-empty `description` field wrapped in single quotes
223238
- [ ] Has `applyTo` field with file patterns
224239
- [ ] File name is lower case with hyphens
225240

226-
For agent files (*.agent.md):
241+
For agent files (\*.agent.md):
242+
227243
- [ ] Has markdown front matter
228244
- [ ] Has non-empty `description` field wrapped in single quotes
229245
- [ ] Has `name` field with human-readable name (e.g., "Address Comments" not "address-comments")
230246
- [ ] File name is lower case with hyphens
231247
- [ ] Includes `model` field (strongly recommended)
232248
- [ ] Considers using `tools` field
233249

234-
For skills (skills/*/):
250+
For skills (skills/\*/):
251+
235252
- [ ] Folder contains a SKILL.md file
236253
- [ ] SKILL.md has markdown front matter
237254
- [ ] Has `name` field matching folder name (lowercase with hyphens, max 64 characters)
@@ -240,7 +257,8 @@ For skills (skills/*/):
240257
- [ ] Any bundled assets are referenced in SKILL.md
241258
- [ ] Bundled assets are under 5MB per file
242259

243-
For hook folders (hooks/*/):
260+
For hook folders (hooks/\*/):
261+
244262
- [ ] Folder contains a README.md file with markdown front matter
245263
- [ ] Has `name` field with human-readable name
246264
- [ ] Has non-empty `description` field wrapped in single quotes
@@ -250,7 +268,8 @@ For hook folders (hooks/*/):
250268
- [ ] Follows [GitHub Copilot hooks specification](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/use-hooks)
251269
- [ ] Optionally includes `tags` array field for categorization
252270

253-
For workflow files (workflows/*.md):
271+
For workflow files (workflows/\*.md):
272+
254273
- [ ] File has markdown front matter
255274
- [ ] Has `name` field with human-readable name
256275
- [ ] Has non-empty `description` field wrapped in single quotes
@@ -260,7 +279,8 @@ For workflow files (workflows/*.md):
260279
- [ ] No `.yml`, `.yaml`, or `.lock.yml` files included
261280
- [ ] Follows [GitHub Agentic Workflows specification](https://github.github.com/gh-aw/reference/workflow-structure/)
262281

263-
For plugins (plugins/*/):
282+
For plugins (plugins/\*/):
283+
264284
- [ ] Directory contains a `.github/plugin/plugin.json` file
265285
- [ ] Directory contains a `README.md` file
266286
- [ ] `plugin.json` has `name` field matching the directory name (lowercase with hyphens)
@@ -275,6 +295,7 @@ For plugins (plugins/*/):
275295
## Contributing
276296

277297
This is a community-driven project. Contributions are welcome! Please see:
298+
278299
- [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines
279300
- [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for community standards
280301
- [SECURITY.md](SECURITY.md) for security policies

0 commit comments

Comments
 (0)