|
| 1 | +--- |
| 2 | +name: update-changelog |
| 3 | +description: > |
| 4 | + Update public/documentation/changelog.html with commits for a new Chamilo release. |
| 5 | + Applies the filtering and formatting rules from tests/scripts/packaging/gitlog.php, |
| 6 | + classifies commits into changelog categories, and reports a line-count summary per |
| 7 | + category. Use when the user wants to update the changelog, prepare a release entry, |
| 8 | + add a version section, or runs /update-changelog. |
| 9 | +--- |
| 10 | + |
| 11 | +# Update Changelog |
| 12 | + |
| 13 | +Update `public/documentation/changelog.html` with the commits for a new Chamilo |
| 14 | +release. The changelog is **progressive**: a version section may be created and |
| 15 | +updated multiple times before the release tag is actually set. Handle both cases. |
| 16 | + |
| 17 | +--- |
| 18 | + |
| 19 | +## Step 1: Determine the target version |
| 20 | + |
| 21 | +Ask the user: **"Which version number are we adding or updating? (e.g. 2.0.4)"** |
| 22 | + |
| 23 | +Once you have the version, check whether a section for it already exists in |
| 24 | +`public/documentation/changelog.html` by looking for `<a id="X.Y.Z">`. |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## Step 2: Determine the commit range |
| 29 | + |
| 30 | +The range is **"commits not yet listed in the changelog for this version"**. How to |
| 31 | +find it depends on whether the section already exists: |
| 32 | + |
| 33 | +**If the section already exists (progressive update):** |
| 34 | +- Extract every commit SHA already present in that version's `<li>` entries. |
| 35 | +- Run `git log --pretty=format:'%H' HEAD` and skip every SHA that appears (by |
| 36 | + its 8-char or 12-char prefix) in the existing section. |
| 37 | +- The range to process is everything since the newest already-listed commit. |
| 38 | + Concretely: find the most recent commit in the section, then use |
| 39 | + `git log --pretty=... <that-SHA>..HEAD` as the range. |
| 40 | +- If the section exists but has no `<li>` entries yet, fall back to the |
| 41 | + previous-release tag as the start point (see below). |
| 42 | + |
| 43 | +**If the section does not yet exist:** |
| 44 | +- Identify the most recent existing release tag on this branch via |
| 45 | + `git tag --merged HEAD --sort=-version:refname | grep -E '^v[0-9]'`. |
| 46 | +- The most recent tag is the start of the range: `git log v2.0.X..HEAD`. |
| 47 | +- If the tag name is ambiguous (e.g. `v2.0.2` vs `2.0.2`), ask the user to |
| 48 | + confirm before running the log command. |
| 49 | + |
| 50 | +--- |
| 51 | + |
| 52 | +## Step 3: Apply the gitlog.php filtering rules |
| 53 | + |
| 54 | +Read `tests/scripts/packaging/gitlog.php` to confirm the rules are unchanged |
| 55 | +before processing. Then apply them in this order to each commit's subject line: |
| 56 | + |
| 57 | +### 3a. Hard-skip entire commits whose subject starts with any of: |
| 58 | +- `Update language terms` |
| 59 | +- `Update language vars` |
| 60 | +- `Update lang vars` |
| 61 | +- `Merge` (also lowercase `merge`) |
| 62 | +- `Scrutinizer Auto-Fixes` |
| 63 | +- `Update changelog` |
| 64 | +- `Fix PHP Warning` |
| 65 | + |
| 66 | +Also skip any commit whose subject starts with `Minor` (case-insensitive, |
| 67 | +first 5 characters — matches `Minor`, `MINOR`, `minor:`, etc.). |
| 68 | + |
| 69 | +> **Note:** `gitlog.php` defines a `$skipTechnicalPrefixes` array (QA, Internal, |
| 70 | +> Display, Fix, Refactor, Migration, UI, …) but **never uses it** — it is dead |
| 71 | +> code. Do NOT filter on those prefixes; the existing changelog includes |
| 72 | +> `Internal:`, `Display:`, and `Fix:` entries. |
| 73 | +
|
| 74 | +### 3b. Normalise separator punctuation (applied in this exact order): |
| 75 | +1. `^(\w+) - (.*)` → `$1: $2` |
| 76 | +2. `^(\w+ \w+) - (.*)` → `$1: $2` |
| 77 | +3. `^(\w+) : (.*)` → `$1: $2` |
| 78 | + |
| 79 | +### 3c. Rename known prefix mistakes via sanitizeCategory(): |
| 80 | +Apply the full substitution table below (case-insensitive prefix match, |
| 81 | +replace prefix only, keep the rest of the message): |
| 82 | + |
| 83 | +| Wrong prefix | Correct prefix | |
| 84 | +|---|---| |
| 85 | +| Quiz / Exercises | Exercise | |
| 86 | +| LP / Learning Paths / LearningPath / Learnpaths | Learnpath | |
| 87 | +| Documents | Document | |
| 88 | +| Announcements | Announcement | |
| 89 | +| RemedialCourse | Plugin: RemedialCourse | |
| 90 | +| Groups / [usergroup] | Group | |
| 91 | +| Survey report / Survey list export | Survey | |
| 92 | +| Learnpath report | Learnpath | |
| 93 | +| TopLink / TopLinks | Plugin: TopLinks | |
| 94 | +| Sessions | Session | |
| 95 | +| Cas | Authentication: CAS | |
| 96 | +| Webservices / WebService / Web services | Webservice | |
| 97 | +| BBB | Plugin: BigBlueButton | |
| 98 | +| My Progress / My Progres / Reports / Reporting | Tracking | |
| 99 | +| Courses | Display | |
| 100 | +| [LP] | Learnpath | |
| 101 | +| Student follow page | Tracking: Student follow-up | |
| 102 | +| REST | Webservice: REST | |
| 103 | +| Import CSV / ImportCSV / Import_csv.php | Admin: CSV import | |
| 104 | +| [Minor] | Minor: | |
| 105 | +| [admin] | Admin | |
| 106 | +| MySpace | Tracking | |
| 107 | +| Career diagram / Careers | Career | |
| 108 | +| Users | User | |
| 109 | +| Style: | Display: | |
| 110 | +| Course Announcement | Announcement | |
| 111 | +| Testing / CI | QA | |
| 112 | +| Blogs | Blog | |
| 113 | +| Gradebook eval | Gradebook | |
| 114 | +| Survey test | QA: Survey | |
| 115 | +| Editor | WYSIWYG | |
| 116 | +| Global | Internal | |
| 117 | +| Extra field | Extra Fields | |
| 118 | +| Settings | Admin | |
| 119 | +| Changelog | Documentation | |
| 120 | +| Session import | Admin: Session import | |
| 121 | +| XAPI | xAPI | |
| 122 | +| CourseCopy / Course Copy | Maintenance | |
| 123 | +| Course Backup | Maintenance | |
| 124 | +| SSO | Authentication: Single Sign On | |
| 125 | +| Skills | Skill | |
| 126 | +| Messages | Message | |
| 127 | +| Security fixes - | Security: | |
| 128 | +| Work / Works / Pending works | Assignment | |
| 129 | +| Improve code | Internal: Improve code | |
| 130 | +| Thematic / Thematic advance | Course Progress | |
| 131 | +| Agenda | Calendar | |
| 132 | +| Course import | Maintenance | |
| 133 | +| Student publication / Student publications | Assignment | |
| 134 | + |
| 135 | +### 3d. Strip issue references from the message text: |
| 136 | +If the subject matches `((BT)?#\d{2,5})`, remove the first match and anything |
| 137 | +after these patterns: ` see ISSUE`, ` - ref`, ` -refs `, ` - refs `, ` ISSUE`. |
| 138 | + |
| 139 | +### 3e. Finalise: |
| 140 | +Apply `ucfirst()` (capitalise the first character of the message). |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +## Step 4: Classify commits into categories |
| 145 | + |
| 146 | +Use the **normalised message prefix** (the part before the first `:`) to assign |
| 147 | +each commit to a category. Apply in priority order — stop at the first match: |
| 148 | + |
| 149 | +| Category | Message prefix matches (case-insensitive) | |
| 150 | +|---|---| |
| 151 | +| **Security fixes** | `Security` | |
| 152 | +| **Fixed** | `Fix`, `Bug`, `Install`, `Language`, `Hotfix` | |
| 153 | +| **Added** | `Add`, `New`, `Enable`, `Feature`, `Implement`, `Create`, `Include`, `Introduce` | |
| 154 | +| **Removed** | `Remove`, `Delete`, `Drop`, `Deprecate` | |
| 155 | +| **Changed** | Everything else (Internal, Display, Refactor, Plugin, Auth, Learnpath, Exercise, …) | |
| 156 | + |
| 157 | +Omit a category section entirely if it has zero entries. |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +## Step 5: Build each `<li>` line |
| 162 | + |
| 163 | +Format (newest-first, matching existing changelog style): |
| 164 | + |
| 165 | +```html |
| 166 | +<li>[YYYY-MM-DD] (<a href="https://github.com/chamilo/chamilo-lms/commit/SHA12">SHA8</a>) Message</li> |
| 167 | +``` |
| 168 | + |
| 169 | +When a BT# or GH# issue link exists, add it between the commit link and the |
| 170 | +closing `)`: |
| 171 | + |
| 172 | +```html |
| 173 | +<li>[YYYY-MM-DD] (<a href="https://github.com/chamilo/chamilo-lms/commit/SHA12">SHA8</a> - <a href="https://task.beeznest.com/issues/NUM">BT#NUM</a>) Message</li> |
| 174 | +``` |
| 175 | + |
| 176 | +Where `SHA12` = first 12 chars of the full SHA, `SHA8` = first 8 chars. |
| 177 | + |
| 178 | +Correct any obvious typos in commit messages when formatting for publication |
| 179 | +(the HTML is user-facing; the git history is not changed). Note corrections in |
| 180 | +the final report. |
| 181 | + |
| 182 | +--- |
| 183 | + |
| 184 | +## Step 6: Ask for the release codename |
| 185 | + |
| 186 | +Ask: **"What codename should I use for version X.Y.Z? (Leave blank to insert a placeholder)"** |
| 187 | + |
| 188 | +- If provided, use it: `Chamilo X.Y.Z - Codename, YYYY-MM-DD` |
| 189 | +- If blank, use: `Chamilo X.Y.Z - [TBD], YYYY-MM-DD` |
| 190 | +- Use today's date as the release date unless the user specifies another. |
| 191 | +- Historical context: codenames have been small cities/towns/villages in the |
| 192 | + Somerset/Cheddar region of England (Cadbury, Blackford, Little Weston, Axbridge). |
| 193 | + |
| 194 | +--- |
| 195 | + |
| 196 | +## Step 7: Write or update the changelog |
| 197 | + |
| 198 | +**If the section does not yet exist:** insert it above the previous release's |
| 199 | +`<a id="...">` anchor. Also add an entry to the `<div class="toc">` `<ul>` at |
| 200 | +the top, above the previous release's TOC line. |
| 201 | + |
| 202 | +**If the section already exists (progressive update):** append the new `<li>` |
| 203 | +entries into the correct category `<ul>`. If a commit's category `<h3>` block |
| 204 | +does not exist yet in that section, create it in the correct order: |
| 205 | +Security fixes → Added → Changed → Fixed → Removed → Known issues. |
| 206 | + |
| 207 | +The release summary `<p>` should be written or updated to reflect the nature of |
| 208 | +the commits in this update. If the section is new, write a brief paragraph. If |
| 209 | +updating an existing section, revise the summary if the new commits materially |
| 210 | +change its character. |
| 211 | + |
| 212 | +--- |
| 213 | + |
| 214 | +## Step 8: Report |
| 215 | + |
| 216 | +Print a summary table: |
| 217 | + |
| 218 | +``` |
| 219 | +Changelog updated for Chamilo X.Y.Z - Codename |
| 220 | +
|
| 221 | +Category | Lines added |
| 222 | +-----------------|------------ |
| 223 | +Security fixes | N |
| 224 | +Added | N |
| 225 | +Changed | N |
| 226 | +Fixed | N |
| 227 | +Removed | N |
| 228 | +Total | N |
| 229 | +
|
| 230 | +Filtered out (not included): |
| 231 | + - M merge commits |
| 232 | + - K minor/noise commits |
| 233 | +
|
| 234 | +Typo corrections applied: |
| 235 | + - <SHA8>: "<original>" → "<corrected>" (or "none") |
| 236 | +``` |
| 237 | + |
| 238 | +--- |
| 239 | + |
| 240 | +## Guidelines |
| 241 | + |
| 242 | +- Always read `tests/scripts/packaging/gitlog.php` at the start to check for |
| 243 | + rule changes before applying the filter logic above. |
| 244 | +- The changelog is the user-facing record. Prefer clarity over verbatim |
| 245 | + faithfulness to commit messages. |
| 246 | +- Never invent commits. Only include SHAs that appear in the git log output. |
| 247 | +- Do not modify any section other than the target version. |
| 248 | +- If the user provides a specific date, use that; otherwise use today's date. |
0 commit comments