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
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+10-12Lines changed: 10 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,22 +1,22 @@
1
1
# Copilot instructions
2
2
3
-
## scripts in the `gh-cli` and `scripts` directories
3
+
## Scripts in the `gh-cli` and `scripts` directories
4
4
5
5
When creating or modifying scripts in the `gh-cli` and `scripts` directories:
6
6
7
7
- Ensure the script has input parameters
8
8
- Include input validation and meaningful error messages
9
9
- Ensure the script has a basic description and usage examples at the top
10
-
- Make sure to paginate (`--paginate` and/or `octokit.paginate`) when retrieving results
11
10
- Note any special permissions/token requirements
12
11
- If modifying input parameters to a script, make sure to update the respective `README.md` in the script directory (if applicable)
13
12
- Use only `2` spaces for indentation - not `4`
14
13
- Do not leave any trailing whitespace at the end of lines
15
-
- With `gh api` commands, prefer `--jq` versus piping to `jq` when possible
14
+
- Make sure to paginate (`--paginate` and/or `octokit.paginate`) when retrieving results in any script
15
+
- Prefer `--jq` flag with `gh api` over piping to `jq` when possible
16
16
- Include the header `-H "X-Github-Next-Global-ID: 1"` in GraphQL queries to retrieve the new global ID format - see the [GitHub migration guide for global node IDs](https://docs.github.com/en/graphql/guides/migrating-graphql-global-node-ids) for details
17
17
- Complex scripts in the `./scripts` directory should have its own folder (so a `package.json` can be included for example)
18
18
19
-
## README.md documentation
19
+
## Documentation in README.md files
20
20
21
21
When adding new scripts to any directory:
22
22
@@ -25,29 +25,27 @@ When adding new scripts to any directory:
25
25
- Include a clear description, usage examples, and any prerequisites/notes
26
26
- We don't need both usage AND an example of running the script - just one please
27
27
- Use proper kebab-case naming convention for script files
28
-
- Avoid short words like "repo" (use "repository"), "org" (use "organization")
29
-
- Test that the entry passes `lint-readme.js` validation
28
+
- Avoid abbreviations like "repo" (use "repository"), "org" (use "organization")
29
+
- Test that the entry passes `lint-readme.js` validation before committing (after staging)
30
30
- Don't be too verbose - keep descriptions and usage instructions concise and to the point
31
31
- Don't use periods after bullet points for consistency
32
32
33
-
## script naming and structure
33
+
## Script naming and structure
34
34
35
35
- Use kebab-case for all script filenames (e.g., `get-organization-repositories.sh`)
36
36
- Include appropriate file extensions (.sh, .ps1, .js, .py)
37
37
- Make shell scripts executable with `chmod +x`
38
38
- Add shebang lines at the top of scripts (e.g., `#!/bin/bash`)
39
-
- Include error handling and parameter validation
40
39
41
-
## API and authentication patterns
40
+
## Authentication / permissions patterns
42
41
43
-
- Use `gh api --paginate` for GitHub CLI API calls
44
-
- Include proper error handling for API rate limits and permissions
42
+
- Include proper error handling for API rate limits and permission errors
45
43
- Document required scopes and permissions in script comments
46
44
- Use environment variables or parameters for sensitive data (never hardcode tokens)
47
45
- For scripts requiring special permissions, mention this in both script comments and README
48
46
- Add hostname support for GitHub Enterprise instances / ghe.com when applicable
0 commit comments