Skip to content

Commit e14ddcc

Browse files
Migrating code.json validation to Zod with tests (#100)
* added archival option * changed workflow to archive * reverting archive option * testing null status key * added back archive to a null status field * reverting workflow file * reverting code.json * reverting version * fixed syntax * added tags logic * created new test file and restructed directories
1 parent bda79bd commit e14ddcc

13 files changed

Lines changed: 659 additions & 163 deletions

File tree

.github/workflows/updateCodeJSON.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
pull_request:
55
types: [opened, synchronize]
66
paths:
7-
- 'code.json'
7+
- "code.json"
88

99
permissions:
1010
contents: write

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Code.json Auto Generator
2+
23
###### _⚠️ Please update your action to v1.2.1 if your workflow is failing due to Docker builds within the action ⚠️_
34

45
A GitHub Action that automatically generates and maintains code.json files for federal open source repositories, ensuring schema consistency and automating metadata calculations.
@@ -32,19 +33,22 @@ This approach tries to push directly to the branch using a Personal Access Token
3233
#### Direct Push Mode Limitations
3334

3435
**Important:** Direct push mode (`SKIP_PR: "true"`) will fall back to creating a pull request if:
36+
3537
- Branch protection rules are enabled on the target branch
3638
- The PAT doesn't have sufficient permissions
3739
- Any other push restriction exists
3840

3941
This is expected behavior. If you need all updates to go through pull requests, use `SKIP_PR: "false"`.
4042

4143
##### When Direct Push Works
44+
4245
- No branch protection on target branch
4346
- PAT has write access
4447
- No other repository restrictions
4548

4649
##### When It Falls Back to PR
47-
- Any branch protection enabled
50+
51+
- Any branch protection enabled
4852
- Any push restrictions
4953

5054
**Recommendation:** For repositories with branch protection, use `SKIP_PR: "false"` to always create pull requests.
@@ -181,7 +185,7 @@ To use the direct push functionality, you'll need to create a Personal Access To
181185
5. **Configure Token**:
182186
- **Name**: Give it a name like "code.json Generator"
183187
- **Expiration**: Set appropriate expiration (recommend 90 days or 1 year)
184-
- **Scopes**:
188+
- **Scopes**:
185189
- For classic tokens: Select `repo` (full repository access)
186190
- For fine-grained tokens: Select `Contents` (write) and `Metadata` (read)
187191
6. **Copy the generated token**: Copy the token and keep it handy for the next section

__fixtures__/core.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

__tests__/main.test.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

code.json

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,10 @@
2828
"forks": 4,
2929
"clones": 0
3030
},
31-
"platforms": [
32-
"web",
33-
"linux"
34-
],
35-
"categories": [
36-
"developer-tools",
37-
"automation"
38-
],
31+
"platforms": ["web", "linux"],
32+
"categories": ["developer-tools", "automation"],
3933
"softwareType": "standalone/backend",
40-
"languages": [
41-
"TypeScript",
42-
"JavaScript"
43-
],
34+
"languages": ["TypeScript", "JavaScript"],
4435
"maintenance": "internal",
4536
"contractNumber": [],
4637
"SBOM": "https://github.com/DSACMS/automated-codejson-generator/network/dependencies",
@@ -72,15 +63,9 @@
7263
"userInput": false,
7364
"fismaLevel": "low",
7465
"group": "CMS/OA/DSAC",
75-
"projects": [
76-
"share-it-act"
77-
],
66+
"projects": ["share-it-act"],
7867
"systems": [],
79-
"subsetInHealthcare": [
80-
"operational"
81-
],
82-
"userType": [
83-
"government"
84-
],
68+
"subsetInHealthcare": ["operational"],
69+
"userType": ["government"],
8570
"maturityModelTier": 3
8671
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"name": "automated-codejson-generator",
3+
"version": "1.0.0",
4+
"description": "A GitHub Action that generates code.json files",
5+
"longDescription": "This action helps federal agencies maintain code.json files for compliance.",
6+
"status": "Production",
7+
"permissions": {
8+
"licenses": [
9+
{
10+
"name": "CC0 1.0 Universal",
11+
"URL": "https://creativecommons.org/publicdomain/zero/1.0/"
12+
}
13+
],
14+
"usageType": ["openSource"],
15+
"exemptionText": ""
16+
},
17+
"organization": "DSACMS",
18+
"repositoryURL": "https://github.com/DSACMS/automated-codejson-generator",
19+
"repositoryHost": "github",
20+
"repositoryVisibility": "public",
21+
"vcs": "git",
22+
"laborHours": 500,
23+
"reuseFrequency": {
24+
"forks": 10,
25+
"clones": 50
26+
},
27+
"platforms": ["github-actions"],
28+
"categories": ["compliance", "automation"],
29+
"softwareType": "tool",
30+
"languages": ["TypeScript"],
31+
"maintenance": "active",
32+
"contractNumber": [],
33+
"SBOM": "https://github.com/DSACMS/automated-codejson-generator/network/dependencies",
34+
"date": {
35+
"created": "2024-01-01T00:00:00Z",
36+
"lastModified": "2024-06-15T00:00:00Z",
37+
"metadataLastUpdated": "2024-06-20T00:00:00Z"
38+
},
39+
"tags": ["code.json", "federal", "open-source"],
40+
"contact": {
41+
"email": "opensource@cms.hhs.gov",
42+
"name": "CMS Open Source Team"
43+
},
44+
"feedbackMechanism": "https://github.com/DSACMS/automated-codejson-generator/issues",
45+
"AIUseCaseID": "0",
46+
"localisation": false,
47+
"repositoryType": "source",
48+
"userInput": false,
49+
"fismaLevel": "low",
50+
"group": "DSACMS",
51+
"projects": [],
52+
"systems": [],
53+
"subsetInHealthcare": [],
54+
"userType": ["developer"],
55+
"maturityModelTier": 1
56+
}

0 commit comments

Comments
 (0)