Skip to content

Commit e8cc2f7

Browse files
EbonsignoriCopilot
andauthored
add engineering guidelines to copilot-instructions (#56534)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a3c9166 commit e8cc2f7

File tree

1 file changed

+42
-22
lines changed

1 file changed

+42
-22
lines changed

.github/copilot-instructions.md

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,44 @@
1-
This documentation repository consists mainly of content written in Markdown format. These files are converted into HTML for displaying on a website. Most Markdown files become a single article on the documentation site. Other files contain reusable content which is inserted into multiple articles. The repository also contains YAML files (e.g. for variable text), image files, JavaScript/TypeScript files, etc.
1+
This repository contains code to run the GitHub Docs site on docs.github.com, as well as the content that is displayed on the site. The code is written in JavaScript and TypeScript, and the content is primarily written in Markdown.
2+
3+
Changes to files in `src/*` or files with `.ts` or `.js` extensions are likely code-related changes. Please follow the engineering guidelines below when making changes to these files.
4+
5+
Changes to files in `content/*` and `data/*` are likely content-related changes. Content changes include updates to articles, reusable content, and data files that define variables used in articles. Please follow the content guidelines below when making changes to these files.
6+
7+
## Engineering guidelines
8+
9+
### Scripts
10+
11+
All scripts can be found in `package.json`.
12+
13+
To validate any code changes:
14+
- `npm run tsc`
15+
- `npm run build`
16+
- `npm run prettier`
17+
- `npm run lint`: you can include `-- --fix`
18+
19+
To validate specific changes,
20+
- `npm run test`: For all unit tests
21+
- You can pass specific paths, e.g. `npm run test -- src/search/tests/ai-search-proxy`
22+
- You can add `--silent=false` to include `console.log` debugging.
23+
- `npm run build && npm run playwright-test -- playwright-rendering`: You need to build for changes outside of the test to be picked up. We use playwright for all rendering and end-to-end tests
24+
- You can add `--ui` to keep open `localhost:4000` which can be viewed in a simple browser for debugging UI state.
25+
- `npm run dev` to start the development server on `localhost:4000`.
26+
27+
### Imports
28+
29+
We use absolute imports, relative to the `src` directory, using the `@` symbol.
30+
31+
For example, `getRedirect` which lives inn `src/redirects/lib/get-redirect.js` can be imported with `import getRedirect from '@/redirects/lib/get-redirect'`.
32+
33+
The same rule applies for TypeScript (`.ts`) imports, e.g. `import type { GeneralSearchHit } from '@/search/types'`
34+
35+
### Testing changes
36+
37+
We use `vitest` to write unit tests. Tests live in their own files in the `tests` subdirectory of a source (src) directory, e.g. `src/search/tests/api-ai-search.ts`.
38+
39+
For integration tests, we can use the mock server in `src/tests/mocks/start-mock-server.ts` to mock exteneral requests.
40+
41+
For UI rendering tests, we use `playwright` and write tests in `src/fixtures/tests/playwright-rendering.spec.ts`
242

343
## Content guidelines
444

@@ -90,31 +130,11 @@ Then, within a collapsed section, quote the original prompt from Copilot Chat:
90130

91131
This helps reviewers understand the context and intent behind the automated changes.
92132

93-
## Development and testing guidelines
94-
95-
### Content changes
133+
### Testing Content changes
96134

97135
Before committing content changes, always:
98136

99137
1. **Use the content linter** to validate content: `npm run lint-content -- --paths <file-paths>`
100138
2. **Check for proper variable usage** in your content
101139
3. **Verify [AUTOTITLE] links** point to existing articles
102140
4. **Run tests** on changed content: `npm run test -- src/content-render/tests/render-changed-and-deleted-files.js`
103-
104-
### Script and code changes
105-
106-
For TypeScript, JavaScript, and SCSS files:
107-
108-
1. **Run Prettier** to check formatting: `npm run prettier-check`
109-
2. **Run the linter**: `npm run lint`
110-
3. **Run TypeScript checks**: `npm run tsc`
111-
4. **Run relevant tests**: `npm test`
112-
113-
### Environment setup
114-
115-
When testing changes in your development environment:
116-
117-
1. Install dependencies: `npm ci`
118-
2. For content changes, ensure the content linter runs successfully
119-
3. For script changes, ensure all formatting and linting checks pass
120-
4. Always verify your changes don't break existing functionality

0 commit comments

Comments
 (0)