@@ -6,40 +6,76 @@ for versioned docs by comparing updates since a provided cutoff in the current
66
77The default cutoff date is the last run date for the provided product slug, if
88it exists. Otherwise, the script defaults to the creation date of the RC release
9- branch. The script standardizes all timestamps to ISO for simplicity but takes
10- the optional override date as a local time.
9+ branch, which it calculates as the date of the first commit associated with the
10+ branch that does not exist in main. The script standardizes all timestamps to
11+ UTC for simplicity but takes the optional override date as a local time.
1112
1213
1314## Assumptions
1415
15- - Your RC release branch use the following naming convention: ` <product_slug>/<rc_version > <docTag> ` .
16+ - Your RC folder uses the following naming convention: ` <product_slug>/<rc_folder > <docTag> ` .
1617- You have the GitHub CLI (` gh ` ) installed. The CLI is required if you want the
1718 script to create a PR on your behalf. ==> DISABLED (THE PROCESS IS STILL BUGGY)
1819
20+ ## Usage
21+
22+ ``` text
23+ node sync-ga-to-rc.mjs -slug <product> -ga <ga_folder> -rc <rc_folder> [<optional_flags>]
24+ ```
1925
2026## Flags
2127
22- Flag | Type | Default | Description
23- --------- | -------- | ------------ | -----------
24- ` -slug ` | ` string ` | No, required | Product slug used for the root content folder
25- ` -ga ` | ` string ` | No, required | Version of the current docset
26- ` -rc ` | ` string ` | No, required | Version of the unreleased docset
27- ` -tag ` | ` string ` | "" | String used to tag non-GA docsets (e.g., "(rc)")
28- ` -branch ` | ` string ` | ` main ` | Name of the GA branch
29- ` -date ` | ` string ` | null | Local override date in "YYYY-MM-DD HH:MM: SS " format for the commit date cutoff
30- ` -update ` | ` bool ` | false | Indicates whether to apply any safe changes locally
31- ` -pr ` | ` bool ` | false | Indicates whether to apply any safe changes locally and generate a PR if possible
32- ` -merged ` | ` bool ` | false | Indicates that RC docs are merged to ` -branch `
33- ` -help ` | ` bool ` | false | Print usage help text and exit
28+ Flag | Type | Default | Description
29+ ----------- | -------- | ---------------------------- | -----------
30+ ` -slug ` | ` string ` | None, required | Product slug used for the root content folder
31+ ` -ga ` | ` string ` | None, required | GA folder; typically the GA version with ` .x `
32+ ` -rc ` | ` string ` | None, required | Unreleased docset folder ; typically the RC version with ` .x `
33+ ` -tag ` | ` string ` | "" | String used to tag non-GA docsets (e.g., "(rc)")
34+ ` -branch ` | ` string ` | ` <product_slug>/<rc_folder> ` | Name of the RC branch
35+ ` -gaBranch ` | ` string ` | ` main ` | Name of the GA branch
36+ ` -date ` | ` string ` | null | Local override date in "YYYY-MM-DD HH:MM: SS " format for the commit date cutoff
37+ ` -update ` | ` bool ` | false | Indicates whether to apply any safe changes locally
38+ ` -pr ` | ` bool ` | false | Indicates whether to apply any safe changes locally and generate a PR if possible
39+ ` -merged ` | ` bool ` | false | Indicates that RC docs are merged to ` -gaBranch `
40+ ` -help ` | ` bool ` | false | Print usage help text and exit
3441
3542
43+ ## Adding exceptions
3644
37- ## Usage
45+ If you have files you ** know** the script should always ignore, you can add the
46+ relative path from your product root to the exclusion file ` data/exclude.json `
47+ using your product slug.
3848
39- ``` text
40- node sync-ga-to-rc.mjs -slug <product> -ga <ga_version> -rc <rc_version> [-tag <folder_tag>] [-branch <ga_branch>] [-date <override_date] [-update] [-pr]
49+ Expected schema:
50+
51+ ``` json
52+ [
53+ {
54+ "<produc_slug>" : [
55+ " <relative_path_1>" ,
56+ " <relative_path_1>" ,
57+ ...
58+ " <relative_path_N>" ,
59+ ]
60+ }
61+ ]
62+ ```
63+
64+ For example:
65+
66+ ``` json
67+ [
68+ {
69+ "vault" : [
70+ " /content/docs/updates/important-changes.mdx" ,
71+ " /content/docs/updates/release-notes.mdx" ,
72+ " /content/docs/updates/change-tracker.mdx"
73+ ]
74+ }
75+ ]
4176```
4277
78+
4379## Examples
4480
4581### Basic call
@@ -48,7 +84,13 @@ node sync-ga-to-rc.mjs -slug <product> -ga <ga_version> -rc <rc_version> [-tag <
4884$ node sync-ga-to-rc.mjs -slug vault -ga 1.20.x -rc 1.21.x -tag rc
4985```
5086
51- ### Provide an override date
87+ ### Provide an explicit release branch name
88+
89+ ``` shell-session
90+ $ node sync-ga-to-rc.mjs -slug boundary -ga 0.20.x -rc 0.21.x -branch boundary/0.21.0
91+ ```
92+
93+ ### Provide an override date and explicit tag string
5294
5395Use ` -tag ` to provide a specific doc tag and set a custom override date with
5496` -date ` :
@@ -76,52 +118,16 @@ $ node sync-ga-to-rc.mjs \
76118
77119### Sync two published versions
78120
79- Use ` -merged ` and set ` -tag ` to "none" so the script compares folders for past
80- versions in ` main ` :
121+ Use ` -merged ` so the script compares folders in ` main ` :
81122
82123``` shell-session
83124$ node sync-ga-to-rc.mjs \
84125 -slug vault \
85126 -ga 1.19.x \
86127 -rc 1.20.x \
87- -merged \
88- -tag none
89- ```
90-
91- ## Adding exceptions
92-
93- If you have files you ** know** the script should always ignore, you can add the
94- relative path from your product root to the exclusion file ` data/exclude.json `
95- using your product slug.
96-
97- Expected schema:
98-
99- ``` json
100- [
101- {
102- "<produc_slug>" : [
103- " <relative_path_1>" ,
104- " <relative_path_1>" ,
105- ...
106- " <relative_path_N>" ,
107- ]
108- }
109- ]
128+ -merged
110129```
111130
112- For example:
113-
114- ``` json
115- [
116- {
117- "vault" : [
118- " /content/docs/updates/important-changes.mdx" ,
119- " /content/docs/updates/release-notes.mdx" ,
120- " /content/docs/updates/change-tracker.mdx"
121- ]
122- }
123- ]
124- ```
125131
126132## General workflow
127133
@@ -133,27 +139,33 @@ Next, the script builds the following file sets:
133139- exclusions - a list of files the script should ignore during the sync
134140- GAΔ - files in the GA (current) docset with a last commit date later
135141 than the provided cutoff date.
142+ than the provided cutoff date.
136143- RCΔ - files in the RC (unreleased) docset with a last commit date
137144 later than the provided cutoff date.
138145- GA-only - files in the GA (current) docset that do not exist in the RC
139146 docset.
147+ - GAd - files deleted from the GA (current) docset that still exist in
148+ the RC (unreleased) docset
140149
141150The script determines what to do with the files based on the following rubric
142151where GAu and RCu are the set of files unchanged since the cutoff in the GA and
143152RC docsets:
144153
145- Set definition | Implication | Action
146- -------------------- | ------------------ | -------------------------
147- file ∈ { RCu ∧ GAu } | file unchanged | ignore
148- file ∈ { RCu ∧ GAΔ } | updated in GA only | safe to update in RC
149- file ∈ { RCΔ ∧ GAu } | updated in RC only | ignore
150- file ∈ { RCΔ ∧ GAΔ } | updated in both | possible conflict; needs manual review
151- file ∈ { RC ∧ !GA } | new file for RC | ignore
152- file ∈ { !RC ∧ GA } | new file for GA | safe to update in RC
153-
154- If ` -update ` is ` true ` , the script slams files in the RC folder with files from
155- the GA folder with any file deemed "safe", prints a note to review the
156- information in the conflict file, and updates the last run date.
154+ Set definition | Implication | Action
155+ -------------------- | -------------------- | -------------------------
156+ file ∈ { RCu ∧ GAu } | file unchanged | ignore
157+ file ∈ { RCu ∧ GAΔ } | updated in GA only | safe to update in RC
158+ file ∈ { RCΔ ∧ GAu } | updated in RC only | ignore
159+ file ∈ { RCΔ ∧ GAΔ } | updated in both | possible conflict; needs manual review
160+ file ∈ { RC ∧ !GA } | new file for RC | ignore
161+ file ∈ { !RC ∧ GA } | new file for GA | safe to update in RC
162+ file ∈ { RC ∧ GAd } | file deleted from GA | safe to delete in RC
163+
164+ If ` -update ` is ` true ` , the script creates a working branch, changes to that
165+ branch, slams files in the RC folder with files from the GA folder with any file
166+ deemed "safe", deletes files in RC that show up as deleted in the gitlog for GA,
167+ prints a note to review the information in the conflict file, and updates the
168+ last run date.
157169
158170If ` -update ` is ` false ` , the script generates log files and exits.
159171
@@ -171,6 +183,7 @@ but it also creates the following artifacts:
171183 File set | Output file
172184 ------------------- | --------------------
173185 GAΔ | output/ga-delta.txt
186+ GAd | output/delete-list.txt
174187 RCΔ | output/rc-delta.txt
175188 GA-only | output/ga-only.txt
176189 updated files | output/safe-list.txt
0 commit comments