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: doc/docs/reference/crs-actions-config/README.md
+68-43Lines changed: 68 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,19 +2,20 @@
2
2
3
3
This document provides a complete reference for the `crs-config.json` configuration file used by CRs Actions in GitHub Actions workflows.
4
4
5
-
## Configuration File Location
5
+
## Overview
6
6
7
-
The configuration file should be placed at `.github/crs-config.json` in your repository root.
7
+
The configuration file should be placed at `.github/crs-config.json` in your repository root. The file uses JSON5 format, which supports comments and trailing commas.
8
8
9
-
## Configuration Schema
9
+
## Quick Start
10
10
11
-
The file uses JSON5 format, which supports comments and trailing commas.
12
-
13
-
### Complete Example
11
+
Here's a complete working example showing all available configuration options:
14
12
15
13
<!-- $MDX file=complete-example.json -->
16
14
```json
17
15
{
16
+
// Enable editor validation and auto-completion (replace with your crs version).
// Alice takes over CRs that are otherwise hard to assign.
19
20
default_repo_owner: "alice",
20
21
@@ -32,15 +33,9 @@ The file uses JSON5 format, which supports comments and trailing commas.
32
33
}
33
34
```
34
35
35
-
You can validate a configuration file using the *crs* cli like this:
36
-
37
-
```bash
38
-
$ crs tools config validate complete-example.json
39
-
```
40
-
41
-
The command silently exit 0 when the config is valid, or otherwise complains on *stderr* and a non zero exit code (examples below).
36
+
Replace `v1.2.3` with your installed `crs` version (check with `crs --version`). The `$schema` field enables editor validation and auto-completion features (see [Validation](#validation) section below).
42
37
43
-
## Fields Reference
38
+
## Configuration Reference
44
39
45
40
### `default_repo_owner`
46
41
@@ -55,11 +50,13 @@ If the repository is owned by an individual, this would typically be that user.
55
50
56
51
-**Type:**`array of strings` (optional)
57
52
-**Example:**`["alice", "bob", "charlie"]`
58
-
-**Default** same as supplying an empty array (no user enabled).
53
+
-**Default:**`[]` (empty array - no mentions allowed)
54
+
55
+
List of users who can be mentioned in CR annotations using `@username` mentions. Only users explicitly listed here can be notified through GitHub mentions.
59
56
60
-
Enables a specific list of users to be notified in annotation comments when notifications are requested. This is a protection measure to avoid spamming users that do not have ties to a repository in particular, or simply do not wish to be notified via CRs.
57
+
If this field is not provided, it defaults to an empty list, meaning no user mentions are allowed. This is a protection measure to avoid spamming users who do not have ties to the repository or do not wish to be notified via CRs.
61
58
62
-
When specified, only users in this allowlist can be mentioned in CR annotations. This helps prevent typos in usernames and ensures CRs are only assigned to valid team members.
59
+
Adding users to this list enables notifications for them and helps prevent typos in usernames by restricting mentions to known team members.
63
60
64
61
### `invalid_crs_annotation_severity`
65
62
@@ -77,23 +74,64 @@ Controls the GitHub annotation severity level for invalid CR syntax. This determ
77
74
78
75
Controls the GitHub annotation severity level for CRs that are due now (such as in the PR where they were found).
79
76
80
-
##GitHub Annotation Severity Levels
77
+
#### About Annotation Severity Levels
81
78
82
-
The severity levels map to GitHub's annotation levels. See[GitHub's documentation on annotation levels](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message) for details on how these are displayed in the UI.
79
+
The severity levels map to GitHub's annotation levels (see[GitHub's documentation](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-error-message) for details):
83
80
84
81
-**Error**: Most prominent display, typically for critical issues
85
-
-**Warning**: Medium prominence, suitable for issues that should be addressed (default for `invalid_crs_annotation_severity`)
86
-
-**Info**: Informational notice messages (default for `crs_due_now_annotation_severity`)
82
+
-**Warning**: Medium prominence, suitable for issues that should be addressed
83
+
-**Info**: Informational notice messages
87
84
88
85
## Validation
89
86
87
+
Configuration files can be validated in two ways: real-time validation in your editor using JSON Schema, or batch validation using the `crs` CLI command.
88
+
89
+
### Editor Validation with JSON Schema
90
+
91
+
CRs provides a JSON Schema that enables real-time validation and editor features like auto-completion, inline validation, and hover documentation.
92
+
93
+
#### Enabling Schema Validation
94
+
95
+
Add a `$schema` field to your `.github/crs-config.json` that matches your installed `crs` version:
Replace `v1.2.3` with your installed `crs` version. Check your version with:
107
+
108
+
<!-- $MDX skip -->
109
+
```bash
110
+
$ crs --version
111
+
```
112
+
113
+
**Important:** When you upgrade `crs`, update the version in the `$schema` URL to match. Editors cache schemas, so using `latest` can cause validation issues when the cached schema doesn't match your installed version.
114
+
115
+
#### Editor Features
116
+
117
+
Once the `$schema` field is added, editors like VS Code will:
118
+
119
+
-**Validate** - Show red squiggles for invalid values or unknown fields
120
+
-**Auto-complete** - Press Ctrl+Space to see available fields and enum values
121
+
-**Hover documentation** - Hover over fields to see their descriptions and valid values
122
+
-**Inline hints** - Get suggestions for default values
123
+
124
+
**Note:** Editors cache the schema locally after the first fetch, so schema validation works offline once cached.
125
+
126
+
### Command-Line Validation
127
+
90
128
The `crs` CLI provides a validation command to check your configuration files. The validation checks:
91
129
- JSON syntax correctness
92
130
- Required fields presence
93
131
- Value type correctness
94
132
- Enum values validity
95
133
96
-
### Basic Validation
134
+
####Basic Validation
97
135
98
136
To validate your configuration file:
99
137
@@ -102,11 +140,9 @@ To validate your configuration file:
102
140
crs tools config validate .github/crs-config.json
103
141
```
104
142
105
-
### Validation Examples
106
-
107
-
#### Valid Minimal Configuration
143
+
#### Validation Examples
108
144
109
-
At the moment all fields in the config are optional, so an empty json object is a minimal valid configuration:
145
+
**Valid Minimal Configuration** - At the moment all fields in the config are optional, so an empty json object is a minimal valid configuration:
110
146
111
147
<!-- $MDX file=valid-minimal.json -->
112
148
```json
@@ -117,13 +153,12 @@ At the moment all fields in the config are optional, so an empty json object is
117
153
$ crs tools config validate valid-minimal.json
118
154
```
119
155
120
-
#### Valid Full Configuration
121
-
122
-
A complete configuration with all optional fields, in regular json:
156
+
**Valid Full Configuration** - A complete configuration with all optional fields, in regular json:
Enum values used to be wrapped in the config format. This is still supported for compatibility but now this creates a warning:
190
+
**Warning: Use of wrapped enum** - Enum values used to be wrapped in the config format. This is still supported for compatibility but now this creates a warning:
162
191
163
192
<!-- $MDX file=wrapped-enum.json -->
164
193
```json
@@ -175,9 +204,7 @@ expected to be a json string rather than a list.
175
204
Hint: Change it to simply: "Warning"
176
205
```
177
206
178
-
#### Invalid: Wrong Type for Field
179
-
180
-
Configuration with incorrect type for `user_mentions_allowlist`:
207
+
**Invalid: Wrong Type for Field** - Configuration with incorrect type for `user_mentions_allowlist`:
181
208
182
209
<!-- $MDX file=invalid-wrong-type.json -->
183
210
```json
@@ -196,9 +223,7 @@ User handle list expected to be a list of json strings.
196
223
[123]
197
224
```
198
225
199
-
#### Invalid: Bad Severity Value
200
-
201
-
Configuration with invalid annotation severity:
226
+
**Invalid: Bad Severity Value** - Configuration with invalid annotation severity:
0 commit comments