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: CONTRIBUTING.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,9 +43,11 @@ npm test
43
43
The action uses [Zod](https://zod.dev/) for schema validation, automatically validating code.json in two scenarios:
44
44
45
45
### 1. Before Generation
46
+
46
47
Every time the action generates or updates code.json (via schedule or workflow_dispatch), it validates the output before creating a PR or pushing. If validation fails, no changes are made.
47
48
48
49
### 2. On PR Edits
50
+
49
51
When the `pull_request` trigger is configured, the action validates code.json whenever it's edited in a PR. This ensures users cannot accidentally merge invalid JSON.
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ method_used:
46
46
47
47
## Workflow Examples
48
48
49
-
### Option 1: Direct Push
49
+
### Option 1: Direct Push
50
50
51
51
This approach tries to push directly to the branch using a Personal Access Token, but falls back to creating a pull request if the direct push fails. When users need to edit code.json, they should create a PR which will automatically validate their changes.
52
52
@@ -59,7 +59,7 @@ on:
59
59
pull_request:
60
60
types: [opened, synchronize]
61
61
paths:
62
-
- 'code.json'
62
+
- "code.json"
63
63
64
64
permissions:
65
65
contents: write
@@ -80,7 +80,7 @@ jobs:
80
80
uses: DSACMS/automated-codejson-generator@v1.2.0
81
81
with:
82
82
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83
-
ADMIN_TOKEN: ${{ secrets.ADMIN_PAT }} # PAT with admin/push permissions
83
+
ADMIN_TOKEN: ${{ secrets.ADMIN_PAT }} # PAT with admin/push permissions
84
84
BRANCH: "main"
85
85
SKIP_PR: "true"
86
86
@@ -107,7 +107,7 @@ on:
107
107
pull_request:
108
108
types: [opened, synchronize]
109
109
paths:
110
-
- 'code.json'
110
+
- "code.json"
111
111
112
112
permissions:
113
113
contents: write
@@ -128,17 +128,19 @@ jobs:
128
128
with:
129
129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130
130
BRANCH: "main"
131
-
SKIP_PR: "false"
131
+
SKIP_PR: "false"
132
132
```
133
133
134
134
### How It Works
135
135
136
136
**Automatic Generation**
137
+
137
138
- The action calculates metadata, validates it, and creates a PR or pushes directly
138
139
- Validation ensures only valid code.json is created
139
140
- Users can then fill in manual fields by editing the PR
140
141
141
142
**PR Validation**
143
+
142
144
- When users edit code.json in a PR, validation runs automatically on every commit
143
145
- The PR cannot be merged if validation fails (when branch protection is enabled)
144
146
- Error messages help users fix issues quickly
@@ -158,7 +160,7 @@ To use the direct push functionality, you'll need to create a Personal Access To
158
160
5. **Configure Token**:
159
161
- **Name**: Give it a name like "code.json Generator"
160
162
- **Expiration**: Set appropriate expiration (recommend 90 days or 1 year)
161
-
- **Scopes**:
163
+
- **Scopes**:
162
164
- Select `repo` (full repository access)
163
165
6. **Store Token**: Copy and paste your token and store it for the next part
164
166
@@ -197,7 +199,7 @@ The automated code.json generator calculates specific fields by analyzing your r
197
199
198
200
**dateLastModified**: This uses your repository's last update timestamp, reflecting the most recent changes. No configuration needed.
199
201
200
-
**dateMetaDataLastUpdated**: The generator sets this to the current timestamp each time it runs, providing a record of when the metadata was last refreshed. No configuration needed.
202
+
**dateMetadataLastUpdated**: The generator sets this to the current timestamp each time it runs, providing a record of when the metadata was last refreshed. No configuration needed.
201
203
202
204
**feedbackMechanism**: The repository's issues URL in the format of {repositoryURL}/issues. If you already have a code.json file with existing feedback mechanisms, the generator preserves those values. No configuration needed.
0 commit comments