Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for auto-determing different CHANGELOG filenames #12

Merged
merged 1 commit into from
Dec 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions github-release-from-changelog.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,26 @@ var cp = require('child_process');
var minimist = require('minimist');
var argv = minimist(process.argv.slice(2));

var fs = require("fs")

// changelog file name
var changelogFileName = argv.filename || "CHANGELOG.md";
var changelogFileName = argv.filename;
if (!changelogFileName) {
const changelogFileNames = [
"CHANGELOG.md", "Changelog.md", "changelog.md",
"CHANGES.md", "Changes.md", "changes.md",
"HISTORY.md", "History.md", "history.md",
"NEWS.md", "News.md", "news.md",
"RELEASES.md", "Releases.md", "releases.md"
];
for (var fileName of changelogFileNames) {
if (fs.existsSync(fileName)) {
changelogFileName = fileName;
break;
}
}
}
// console.log("changelog filename", changelogFileName);

// get dep
var release = require("grizzly")
Expand All @@ -42,7 +60,7 @@ catch(e) {throw "No package.json found in " + process.cwd()}
// read changelog
var changelog
try {
changelog = require("fs").readFileSync(process.cwd() + "/" + changelogFileName, {encoding: "utf8"})
changelog = fs.readFileSync(process.cwd() + "/" + changelogFileName, {encoding: "utf8"})
}
catch(e) {throw "No " + changelogFileName + " found in " + process.cwd()}

Expand Down