Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

github_changelog_generator updates

Jason Kentc78ee7b5373b
diff --git a/.github_changelog_generator b/.github_changelog_generator
new file mode 100644
index 000000000..536268d69
--- /dev/null
+++ b/.github_changelog_generator
@@ -0,0 +1,10 @@
+user=nasa-gibs
+project=worldview
+unreleased=false
+author=false
+bugs-label=## Technical Updates / Bugfixes:
+enhancement-label=## Implemented Enhancements:
+issues-label=## Closed Issues:
+pr-label=## Merged PRs:
+
+
diff --git a/tasks/releaseNotes.js b/tasks/releaseNotes.js
index d3fe31c07..bd9a0bfa3 100644
--- a/tasks/releaseNotes.js
+++ b/tasks/releaseNotes.js
@@ -1,9 +1,23 @@
+// This script will generate an updated CHANGELOG.md
+// Configuration options can be found in the file .github_changelog_generator
+//
+// Accepts two arguments:
+// --ruby Boolean. If provided and true, will try to run locally in Ruby. Otherwise,
+// will spin up a docker container.
+// --since If provided, will only generate notes based on changes since the provided tag
+// --branch The branch from which to pull the history that notes will be generated from.
+// If no branch provided, master is used.
+
+// Expects the following environment variables to be defined:
+// GIT_HOME - Local parent directory of the /worldview dir
+// GITHUB_CHANGELOG_GENERATOR_TOKEN - Github API access token used to request repo history from GitHub.
+// Go to https://github.com/settings/tokens to create one.
+
+/* eslint-disable no-console */
/* eslint no-template-curly-in-string: "off" */
const shell = require('shelljs');
const args = process.argv;
-
-// save arguments to object for options check below
const argStore = {};
args.forEach((val) => {
if (val.match(/=/)) {
@@ -14,28 +28,29 @@ args.forEach((val) => {
}
});
-const { GITHUB_CHANGELOG_GENERATOR_TOKEN } = process.env;
+const { GITHUB_CHANGELOG_GENERATOR_TOKEN, GIT_HOME } = process.env;
if (!GITHUB_CHANGELOG_GENERATOR_TOKEN) {
console.log('\u{1b}[33mA GitHub token is required to make the required number of requests to the GitHub API for release note generation.\u{1b}[0m');
} else {
console.log('\u{1b}[32mA GitHub release note generation initiated. This will take a few minutes to complete.\u{1b}[0m');
- // run docker command by default, but allow ruby using command line argument
- const cmdPrefix = argStore.ruby ? 'github_changelog_generator' : 'docker run -it --rm -v /${PWD}:/wkDir ferrarimarco/github-changelog-generator';
-
- // add --since TAG ARGUMENT to limit compiled release notes
- // NOTE: A complete API request of entire commit history is still required due to GitHub's API, so this won't save you much time
- const sinceOption = argStore.tag ? ` --since-tag ${argStore.tag}` : '';
+ const localWorldviewDir = `${GIT_HOME}/worldview`;
+ const dockerContainerDir = '/usr/local/src/your-app';
+ const cmdPrefix = argStore.ruby
+ ? 'github_changelog_generator'
+ : `docker run -i --rm -v ${localWorldviewDir}:${dockerContainerDir} ferrarimarco/github-changelog-generator`;
- // add --release-branch BRANCH ARGUMENT. default branch is master
+ // NOTE: A complete API request of entire commit history is still required
+ // due to GitHub's API, so this won't save you much time
+ const sinceOption = argStore.since ? ` --since-tag ${argStore.since}` : '';
const branchOption = argStore.branch ? ` --release-branch ${argStore.branch}` : '';
- const cmd = `${cmdPrefix} -u nasa-gibs -p worldview --no-author --no-issues --bugs-label '## Technical Updates / Bugs:' \
---enhancement-label '## Implemented enhancements:' --issues-label '## Closed issues:' --pr-label '## Merged pull requests:' \
---security-label '## External Dependency Updates:' --security-labels 'external dependency' --removed-label \
-'## Story Changes:' --removed-labels 'story,Story' --deprecated-label '## Layer Changes:' --deprecated-labels \
-'layer,Layer'${sinceOption}${branchOption} --token ${GITHUB_CHANGELOG_GENERATOR_TOKEN}`;
+ const cmd = `${cmdPrefix} \
+ --security-label '## External Dependency Updates:' --security-labels 'external dependency' \
+ --removed-label '## Story Changes:' --removed-labels 'story,Story' \
+ --deprecated-label '## Layer Changes:' --deprecated-labels 'layer,Layer' \
+ ${sinceOption}${branchOption} --token ${GITHUB_CHANGELOG_GENERATOR_TOKEN}`;
shell.exec(cmd);
}