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/scripts/validate-structure.js
+28Lines changed: 28 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -49,6 +49,34 @@ function validateFilePath(filePath) {
49
49
constnormalized=filePath.replace(/\\/g,'/');
50
50
constsegments=normalized.split('/');
51
51
52
+
// Check for invalid characters that break local file systems
53
+
for(leti=0;i<segments.length;i++){
54
+
constsegment=segments[i];
55
+
56
+
// Check for trailing periods (invalid on Windows)
57
+
if(segment.endsWith('.')){
58
+
return`Invalid folder/file name '${segment}' in path '${normalized}': Names cannot end with a period (.) as this breaks local file system sync on Windows.`;
59
+
}
60
+
61
+
// Check for trailing spaces (invalid on Windows)
62
+
if(segment.endsWith(' ')){
63
+
return`Invalid folder/file name '${segment}' in path '${normalized}': Names cannot end with a space as this breaks local file system sync on Windows.`;
return`Invalid folder/file name '${segment}' in path '${normalized}': '${nameWithoutExt}' is a reserved name on Windows and will break local file system sync.`;
71
+
}
72
+
73
+
// Check for invalid characters (Windows and general file system restrictions)
74
+
constinvalidChars=/[<>:"|?*\x00-\x1F]/;
75
+
if(invalidChars.test(segment)){
76
+
return`Invalid folder/file name '${segment}' in path '${normalized}': Contains characters that are invalid on Windows file systems (< > : " | ? * or control characters).`;
commentBody += `Your contribution contains file or folder names that will break when syncing to local file systems (especially Windows):\n\n`;
104
+
commentBody += `\`\`\`\n${output}\n\`\`\`\n\n`;
105
+
commentBody += `**Common issues:**\n`;
106
+
commentBody += `- Folder/file names ending with a period (.) - not allowed on Windows\n`;
107
+
commentBody += `- Folder/file names ending with spaces - not allowed on Windows\n`;
108
+
commentBody += `- Reserved names like CON, PRN, AUX, NUL, COM1-9, LPT1-9 - not allowed on Windows\n`;
109
+
commentBody += `- Invalid characters: < > : " | ? * or control characters\n\n`;
110
+
commentBody += `Please rename these files/folders to be compatible with all operating systems.\n\n`;
111
+
} else {
112
+
commentBody += `As a reminder, the general requirements (as outlined in the [CONTRIBUTING.md file](https://github.com/ServiceNowDevProgram/code-snippets/blob/main/CONTRIBUTING.md)) are the following: follow the folder+subfolder guidelines and include a README.md file explaining what the code snippet does.\n\n`;
commentBody += `Review your contribution against the guidelines and make the necessary adjustments. Closing this for now. Once you make additional changes, feel free to re-open this Pull Request or create a new one.`;
117
+
90
118
await github.rest.issues.createComment({
91
119
owner,
92
120
repo,
93
121
issue_number: pullNumber,
94
-
body: `Thank you for your contribution. However, it doesn't comply with our contributing guidelines. As a reminder, the general requirements (as outlined in the [CONTRIBUTING.md file](https://github.com/ServiceNowDevProgram/code-snippets/blob/main/CONTRIBUTING.md)) are the following: follow the folder+subfolder guidelines and include a README.md file explaining what the code snippet does. Review your contribution against the guidelines and make the necessary adjustments. Closing this for now. Once you make additional changes, feel free to re-open this Pull Request or create a new one.`.trim()
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+16-1Lines changed: 16 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,10 +31,25 @@ If you plan to submit another pull request while your original is still pending,
31
31
-**Descriptive Pull Request Titles**: Your pull request must have explicit and descriptive titles that accurately represent the changes made.
32
32
-**Scope Adherence**: Changes that fall outside the described scope will result in the entire pull request being rejected.
33
33
-**Quality Over Quantity**: Low-effort or spam pull requests will be marked accordingly.
34
-
-**Expanded Snippets**: Code snippets reused from the [ServiceNow Documentation](https://docs.servicenow.com/) or [API References](https://developer.servicenow.com/dev.do#!/reference/) are acceptable only if they are expanded in a meaningful way (e.g., with additional context, documentation, or variations). Remember: *“QUANTITY IS FUN, QUALITY IS KEY.”*
34
+
-**Expanded Snippets**: Code snippets reused from the [ServiceNow Documentation](https://docs.servicenow.com/) or [API References](https://developer.servicenow.com/dev.do#!/reference/) are acceptable only if they are expanded in a meaningful way (e.g., with additional context, documentation, or variations). Remember: *"QUANTITY IS FUN, QUALITY IS KEY."*
35
35
-**Relevance**: Code should be relevant to ServiceNow Developers.
36
36
-**ES2021 Compatibility**: While ES2021 is allowed, we encourage you to disclose if your code is using ES2021 features, as not everyone may be working with ES2021-enabled applications.
37
37
38
+
## Core Documentation File Changes
39
+
40
+
**IMPORTANT**: For changes to core documentation files (README.md, CONTRIBUTING.md, LICENSE, etc.), contributors must:
41
+
42
+
1.**Submit an Issue First**: Before making any changes to core documentation files, create an issue describing:
43
+
- What you intend to edit
44
+
- Why the change is needed
45
+
- Your proposed approach
46
+
47
+
2.**Get Assignment**: Wait to be assigned to the issue by a maintainer before submitting a PR.
48
+
49
+
3.**Reference the Issue**: Include the issue number in your PR title and description.
50
+
51
+
This process helps prevent merge conflicts when multiple contributors want to update the same documentation files and ensures all changes align with the project's direction.
52
+
38
53
## Repository Structure
39
54
40
55
**IMPORTANT**: The repository has been reorganized into major categories. All new contributions MUST follow this structure for PR approval.
This snippet provides automatic draft saving functionality for ServiceNow Catalog Items, helping prevent data loss by automatically saving form data at regular intervals.
0 commit comments