Skip to content

Commit f7d13fc

Browse files
committed
docs: add changelog
1 parent 360b5ee commit f7d13fc

File tree

3 files changed

+166
-0
lines changed

3 files changed

+166
-0
lines changed

CHANGELOG.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
You can see the docs for every version at [here](https://dbots.js.org/#/docs).
8+
9+
## [Unreleased]
10+
11+
## [4.4.0] - 2020-07-31
12+
### Added:
13+
- Pull requests: the action can now work in runs triggered by pull request events (issue #48)
14+
15+
## [4.3.0] - 2020-07-29
16+
### Addded:
17+
- `signoff` parameter: lets you use the `--signoff` argument for the `git commit` command (PR #46)
18+
19+
## [4.2.1] - 2020-07-10
20+
### Fixed:
21+
- OS-support: the action now properly works on Windows instances (issue #33)
22+
23+
## [4.2.0] - 2020-05-17
24+
### Added:
25+
- Tagging: you can now create and update lightweight tags (PR #30)
26+
27+
## [4.1.0] - 2020-05-01
28+
### Added:
29+
- `ref` parameter: lets you choose the branch to run the action on, the default is the one that triggered the workflow (issue #29)
30+
31+
## [4.0.3] - 2020-05-01
32+
### Fixed:
33+
- Logs: `git diff` won't display logs anymore, to avoid buffer problems (issue #27)
34+
- Logs: additional info will be logged along with the command outputs
35+
- Logs: added groups to improve readability
36+
37+
## [4.0.2] - 2020-04-19
38+
### Fixed:
39+
- Error handling: failures are now easier to read (issue #25)
40+
41+
## [4.0.1] - 2020-03-20
42+
### Fixed:
43+
- Scheduled events: the action can be used in action runs triggered by a scheduled events
44+
- Warnings: there won't be warnings when both `author_name` and `author_email` are set
45+
46+
## [4.0.0] - 2020-03-03
47+
### Removed:
48+
- **[BREAKING]** `path` parameter: see 'Changed' section for more info
49+
- **[BREAKING]** `pattern` parameter: see 'Changed' section for more info
50+
51+
### Changed:
52+
- The action now uses `git add` and `git rm` commands, you can choose their arguemnts directly by using the `add` and `remove` parameters
53+
- **[BREAKING]** Error handling: the action won't stop if one of your git commands fails (e.g. if one of your pathspecs doesn't match any file)
54+
55+
## [3.1.0] - 2020-02-21
56+
### Added:
57+
- `remove` parameter: lets you delete files directly from the action
58+
59+
## [3.0.0] - 2020-01-24
60+
### Added:
61+
- The action can now run in multiple subsequent jobs in the same workflow
62+
63+
### Removed:
64+
- **[BREAKING]** [`actions/checkout@v1`](https://github.com/actions/checkout/tree/v1) support is being dropped in favor of [`actions/checkout@v2`](https://github.com/actions/checkout/releases/tag/v2)
65+
66+
## [2.3.2] - 2019-12-29
67+
### Added:
68+
- `cwd` parameter: lets you set the Current Working Directory
69+
70+
## [2.3.1] - 2019-12-20
71+
### Added:
72+
- Short tags: from now on, there will be short major tags available (`v2`, `v3`, ...)
73+
74+
## [2.3.0] - 2019-12-14
75+
### Changed:
76+
- TypeScript rewrite: the action will run faster because, unlike with Docker, no build process is needed
77+
78+
### Added:
79+
- OS support: the action can now run in non-Linux environments too
80+
81+
## [2.2.0] - 2019-12-14
82+
### Added:
83+
- The action can automatically fetch the commit author to use
84+
- You can manually provide the author using the `author_name` and `author_email` parameters
85+
86+
## [2.1.1] - 2019-12-07
87+
### Fixed:
88+
- The action can now be used multiple times in the same workflow
89+
90+
## [2.1.0] - 2019-09-19
91+
### Added:
92+
- `force` parameter: uses `--force` when running `git add`
93+
94+
## [2.0.0] - 2019-09-18
95+
### Changed:
96+
- **[BREAKING]** The action now uses a `find` command
97+
98+
## [1.0.0] - 2019-09-17
99+
First release
100+
101+
#
102+
[Unreleased]: https://github.com/EndBug/add-and-commit/compare/v4.4.0...HEAD
103+
[1.0.0]: https://github.com/EndBug/add-and-commit/tree/v1.0.0
104+
[2.0.0]: https://github.com/EndBug/add-and-commit/compare/v1.0.0...v2.0.0
105+
[2.1.0]: https://github.com/EndBug/add-and-commit/compare/v2.0.0...v2.1.0
106+
[2.1.1]: https://github.com/EndBug/add-and-commit/compare/v2.1.0...v2.1.1
107+
[2.2.0]: https://github.com/EndBug/add-and-commit/compare/v2.1.1...v2.2.0
108+
[2.3.0]: https://github.com/EndBug/add-and-commit/compare/v2.2.0...v2.3.0
109+
[2.3.1]: https://github.com/EndBug/add-and-commit/compare/v2.3.0...v2.3.1
110+
[2.3.2]: https://github.com/EndBug/add-and-commit/compare/v2.3.1...v2.3.2
111+
[3.0.0]: https://github.com/EndBug/add-and-commit/compare/v2.3.2...v3.0.0
112+
[3.1.0]: https://github.com/EndBug/add-and-commit/compare/v3.0.0...v3.1.0
113+
[4.0.0]: https://github.com/EndBug/add-and-commit/compare/v3.1.0...v4.0.0
114+
[4.0.1]: https://github.com/EndBug/add-and-commit/compare/v4.0.0...v4.0.1
115+
[4.0.2]: https://github.com/EndBug/add-and-commit/compare/v4.0.1...v4.0.2
116+
[4.0.3]: https://github.com/EndBug/add-and-commit/compare/v4.0.2...v4.0.3
117+
[4.1.0]: https://github.com/EndBug/add-and-commit/compare/v4.0.3...v4.1.0
118+
[4.2.0]: https://github.com/EndBug/add-and-commit/compare/v4.1.0...v4.2.0
119+
[4.2.1]: https://github.com/EndBug/add-and-commit/compare/v4.2.0...v4.2.1
120+
[4.3.0]: https://github.com/EndBug/add-and-commit/compare/v4.2.1...v4.3.0
121+
[4.4.0]: https://github.com/EndBug/add-and-commit/compare/v4.3.0...v4.4.0

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"build": "npm i && ncc build src/main.ts --minify --out lib",
88
"watch": "ncc build src/main.ts --watch --out lib",
99
"all-contributors-badge": "ts-node scripts/all-contributors-badge",
10+
"changelog": "ts-node scripts/changelog.ts",
1011
"test": "echo \"Error: no test specified\" && exit 1"
1112
},
1213
"repository": {

scripts/changelog.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import fs from 'fs'
2+
import path from 'path'
3+
4+
const currentVersion = require('../package.json').version
5+
if (!currentVersion) throw new Error('Cant\'t detect library version.')
6+
7+
const changelogPath = path.resolve(__dirname, '../CHANGELOG.md')
8+
const changelog = fs.readFileSync(changelogPath, { encoding: 'utf-8' })
9+
if (changelog.includes(`## [${currentVersion}]`))
10+
throw new Error('Current version has already been documented.')
11+
let futureChangelog = ''
12+
13+
// Add version section
14+
let arr = changelog.split('## [Unreleased]')
15+
arr[1] = `
16+
17+
## [${currentVersion}] - ${new Date().toISOString().slice(0, 10)}
18+
### Removed:
19+
- **[BREAKING]** ListName: description
20+
21+
### Added:
22+
-
23+
24+
### Fixed:
25+
- ` + arr[1]
26+
futureChangelog = arr.join('## [Unreleased]')
27+
28+
// Update footer
29+
arr = futureChangelog
30+
.split('\n')
31+
.map(line => line.startsWith('[Unreleased]')
32+
? `[Unreleased]: https://github.com/EndBug/add-and-commit/compare/v${currentVersion}...HEAD`
33+
: line)
34+
35+
// eslint-disable-next-line no-useless-escape
36+
const lastVersion = ([...arr].reverse()[1]?.match(/\[([^\][]*)]/) || [])[0].replace(/[\[\]']+/g, '')
37+
if (!lastVersion) throw new Error('Can\'t find last version in changelog.')
38+
39+
const lastLine = `[${currentVersion}]: https://github.com/EndBug/add-and-commit/compare/v${lastVersion}...v${currentVersion}`
40+
if (arr[arr.length - 1] === '') arr[arr.length - 1] = lastLine
41+
else arr.push(lastLine)
42+
futureChangelog = arr.join('\n')
43+
44+
fs.writeFileSync(changelogPath, futureChangelog)

0 commit comments

Comments
 (0)