@alleyinteractive/changelog-extractor 0.0.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -31
- package/action.yml +28 -0
- package/dist/index.js +27563 -0
- package/dist/index.js.map +1 -0
- package/package.json +26 -16
- package/src/cli.js +136 -0
- package/src/index.js +4 -44
- package/src/main.js +50 -0
- package/src/parser.js +157 -55
- package/cli.js +0 -112
package/README.md
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
# Changelog Extractor
|
|
2
2
|
|
|
3
|
-
Parse and extract structured information from
|
|
3
|
+
Parse and extract structured information from
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/) formatted changelogs. Available
|
|
5
|
+
as both a **GitHub Action** and a **CLI tool**.
|
|
4
6
|
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
9
|
+
- Parses Keep a Changelog format (tested with
|
|
10
|
+
[Mantle Framework](https://github.com/alleyinteractive/mantle-framework) and
|
|
11
|
+
others)
|
|
12
|
+
- Extract all versions or filter to a specific one
|
|
13
|
+
- Returns structured data with sections (Added, Changed, Fixed, etc.)
|
|
14
|
+
- Handles mixed formats, including versions without subsections
|
|
15
|
+
- Available as a CLI tool via npx or as a GitHub Action
|
|
16
|
+
- Written in plain JavaScript with no build step required
|
|
15
17
|
|
|
16
18
|
## Usage
|
|
17
19
|
|
|
@@ -42,7 +44,7 @@ By default, the action returns all versions in the changelog:
|
|
|
42
44
|
uses: alleyinteractive/action-changelog-extractor@v1
|
|
43
45
|
with:
|
|
44
46
|
changelog-path: 'CHANGELOG.md'
|
|
45
|
-
version: '1.14.0'
|
|
47
|
+
version: '1.14.0' # or 'v1.14.0'
|
|
46
48
|
```
|
|
47
49
|
|
|
48
50
|
### Create Release from Latest Version
|
|
@@ -77,15 +79,15 @@ jobs:
|
|
|
77
79
|
|
|
78
80
|
#### Action Inputs
|
|
79
81
|
|
|
80
|
-
| Input
|
|
81
|
-
|
|
82
|
-
| `changelog-path` | Path to the changelog file
|
|
83
|
-
| `version`
|
|
82
|
+
| Input | Description | Required | Default |
|
|
83
|
+
| ---------------- | ---------------------------------------------------------------------------------------------- | -------- | --------------- |
|
|
84
|
+
| `changelog-path` | Path to the changelog file | No | `CHANGELOG.md` |
|
|
85
|
+
| `version` | Specific version to extract (e.g., `1.14.0` or `v1.14.0`). Leave empty to return all versions. | No | _(returns all)_ |
|
|
84
86
|
|
|
85
87
|
#### Action Outputs
|
|
86
88
|
|
|
87
|
-
| Output
|
|
88
|
-
|
|
89
|
+
| Output | Description |
|
|
90
|
+
| -------- | ------------------------------------------------------ |
|
|
89
91
|
| `result` | JSON string containing array of parsed version objects |
|
|
90
92
|
|
|
91
93
|
#### Output Structure
|
|
@@ -107,9 +109,12 @@ The `result` output is a JSON string that can be parsed with `fromJson()`:
|
|
|
107
109
|
```
|
|
108
110
|
|
|
109
111
|
**Properties:**
|
|
112
|
+
|
|
110
113
|
- `name` - Version number without "v" prefix
|
|
111
|
-
- `sections` - Object with lowercase keys (`added`, `changed`, `fixed`,
|
|
112
|
-
|
|
114
|
+
- `sections` - Object with lowercase keys (`added`, `changed`, `fixed`,
|
|
115
|
+
`deprecated`, `removed`, `security`)
|
|
116
|
+
- `contents` - Full markdown content for the version (all sections combined,
|
|
117
|
+
without version header)
|
|
113
118
|
|
|
114
119
|
### As a CLI Tool
|
|
115
120
|
|
|
@@ -138,7 +143,8 @@ changelog-extractor
|
|
|
138
143
|
|
|
139
144
|
## Supported Changelog Format
|
|
140
145
|
|
|
141
|
-
This action parses changelogs following the
|
|
146
|
+
This action parses changelogs following the
|
|
147
|
+
[Keep a Changelog](https://keepachangelog.com/) format:
|
|
142
148
|
|
|
143
149
|
```markdown
|
|
144
150
|
# Changelog
|
|
@@ -146,21 +152,26 @@ This action parses changelogs following the [Keep a Changelog](https://keepachan
|
|
|
146
152
|
## v1.14.0
|
|
147
153
|
|
|
148
154
|
### Added
|
|
155
|
+
|
|
149
156
|
- New feature description
|
|
150
157
|
|
|
151
158
|
### Changed
|
|
159
|
+
|
|
152
160
|
- Changes made
|
|
153
161
|
|
|
154
162
|
### Fixed
|
|
163
|
+
|
|
155
164
|
- Bugs fixed
|
|
156
165
|
|
|
157
166
|
## v1.13.0 - 2024-08-15
|
|
158
167
|
|
|
159
168
|
### Added
|
|
169
|
+
|
|
160
170
|
- Another feature
|
|
161
171
|
```
|
|
162
172
|
|
|
163
173
|
**Supported section types:**
|
|
174
|
+
|
|
164
175
|
- Added
|
|
165
176
|
- Changed
|
|
166
177
|
- Deprecated
|
|
@@ -188,18 +199,18 @@ Arguments:
|
|
|
188
199
|
You can also use the parser directly in your Node.js code:
|
|
189
200
|
|
|
190
201
|
```javascript
|
|
191
|
-
const { parseChangelog } = require('@alleyinteractive/changelog-extractor')
|
|
192
|
-
const fs = require('fs')
|
|
202
|
+
const { parseChangelog } = require('@alleyinteractive/changelog-extractor')
|
|
203
|
+
const fs = require('fs')
|
|
193
204
|
|
|
194
|
-
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8')
|
|
205
|
+
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8')
|
|
195
206
|
|
|
196
207
|
// Get all versions
|
|
197
|
-
const allVersions = parseChangelog(changelog)
|
|
208
|
+
const allVersions = parseChangelog(changelog)
|
|
198
209
|
|
|
199
210
|
// Get specific version
|
|
200
|
-
const v1 = parseChangelog(changelog, '1.14.0')
|
|
211
|
+
const v1 = parseChangelog(changelog, '1.14.0')
|
|
201
212
|
|
|
202
|
-
console.log(JSON.stringify(allVersions, null, 2))
|
|
213
|
+
console.log(JSON.stringify(allVersions, null, 2))
|
|
203
214
|
```
|
|
204
215
|
|
|
205
216
|
## Development
|
|
@@ -237,14 +248,19 @@ node cli.js -l
|
|
|
237
248
|
node cli.js CHANGELOG.md 1.0.0
|
|
238
249
|
```
|
|
239
250
|
|
|
240
|
-
##
|
|
251
|
+
## Changelog
|
|
241
252
|
|
|
242
|
-
|
|
253
|
+
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed
|
|
254
|
+
recently.
|
|
243
255
|
|
|
244
|
-
##
|
|
256
|
+
## Credits
|
|
245
257
|
|
|
246
|
-
|
|
258
|
+
This project is actively maintained by
|
|
259
|
+
[Alley Interactive](https://github.com/alleyinteractive).
|
|
247
260
|
|
|
248
|
-
|
|
261
|
+
- [Sean Fisher](https://github.com/srtfisher)
|
|
262
|
+
|
|
263
|
+
## License
|
|
249
264
|
|
|
250
|
-
|
|
265
|
+
The GNU General Public License (GPL) license. Please see [License File](LICENSE)
|
|
266
|
+
for more information.
|
package/action.yml
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: 'Changelog Extractor'
|
|
2
|
+
description:
|
|
3
|
+
'Parse and extract structured information from Keep a Changelog formatted
|
|
4
|
+
changelogs'
|
|
5
|
+
author: 'Alley Interactive'
|
|
6
|
+
|
|
7
|
+
branding:
|
|
8
|
+
icon: 'file-text'
|
|
9
|
+
color: 'blue'
|
|
10
|
+
|
|
11
|
+
inputs:
|
|
12
|
+
changelog-path:
|
|
13
|
+
description: 'Path to the changelog file'
|
|
14
|
+
required: false
|
|
15
|
+
default: 'CHANGELOG.md'
|
|
16
|
+
version:
|
|
17
|
+
description:
|
|
18
|
+
'Specific version to extract (e.g., "1.14.0" or "v1.14.0"). Leave empty to
|
|
19
|
+
return all versions.'
|
|
20
|
+
required: false
|
|
21
|
+
|
|
22
|
+
outputs:
|
|
23
|
+
result:
|
|
24
|
+
description: 'JSON array of parsed changelog entries'
|
|
25
|
+
|
|
26
|
+
runs:
|
|
27
|
+
using: 'node24'
|
|
28
|
+
main: 'dist/index.js'
|