Skip to content

Commit 3a91c0e

Browse files
committed
create a readme for draft logs - throw an error when skipping bad filenames
1 parent 9bdd412 commit 3a91c0e

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

Diff for: draftlogs/.gitignore

-1
This file was deleted.

Diff for: draftlogs/README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Directory of draft logs to help prepare the upcoming [CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md)
2+
3+
It is required that the PR contributors start the filename with a number.
4+
This number should preferably be the PR number.
5+
The number of issue they are trying to close could also be used.
6+
The markdown file should end with one of the followings:
7+
1. `_fix.md` to propose a bug fix
8+
2. `_add.md` to propose new features
9+
3. `_remove.md` to propose a feature removal
10+
4. `_change.md` to propose a minor/major change
11+
5. `_deprecate.md` to propose a feature deprecate
12+
13+
### Example filename and content for PR numbered 5546 for adding a new feature
14+
- filename: `5546_add.md`
15+
- content:
16+
```
17+
- Add `icicle` trace type [[#5546](https://github.com/plotly/plotly.js/pull/5546)]
18+
```
19+
which would render
20+
- Add `icicle` trace type [[#5546](https://github.com/plotly/plotly.js/pull/5546)]
21+
22+
> Please start your single-line or multiple lined message with a verb. You could basically use the PR description while providing a link to the PR similar to the above example is appreciated too.

Diff for: tasks/use_draftlogs.js

+9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var all = {
3333

3434
var ENTER = '\n';
3535

36+
var skippedFiles = [];
3637
for(var i = 0; i < len; i++) {
3738
var filename = allLogs[i];
3839
var message = fs.readFileSync(path.join(pathToDraftlogs, filename), { encoding: 'utf-8' }).toString();
@@ -49,6 +50,8 @@ for(var i = 0; i < len; i++) {
4950
all.Changed.push(message);
5051
} else if(filename.endsWith('_fix.md')) {
5152
all.Fixed.push(message);
53+
} else {
54+
skippedFiles.push(filename);
5255
}
5356
}
5457

@@ -75,3 +78,9 @@ append('Fixed');
7578
draftNewChangelog.push(foot);
7679

7780
fs.writeFileSync(pathToChangelog, draftNewChangelog.join(ENTER), { encoding: 'utf-8' });
81+
82+
if(skippedFiles.length) {
83+
throw JSON.stringify({
84+
'skippedFiles': skippedFiles
85+
}, null, 2);
86+
}

0 commit comments

Comments
 (0)