Skip to content

Commit 79bc79f

Browse files
committed
Fix the [ReferenceError: tags is not defined] error
1 parent 78cad27 commit 79bc79f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ var Github = require('github-api');
1717
* }
1818
*/
1919
function makeRelease(gren, releaseOptions) {
20-
return new Promise(function (resolve, reject) {
20+
return new Promise(function (resolve, reject) {
2121
gren.repo.makeRelease(releaseOptions, function (err, release) {
2222
if(err) {
2323
var responseText = JSON.parse(err.request.responseText);
@@ -65,7 +65,7 @@ function commitMessages(commits) {
6565
* @param {Object[]} tags The collection of tags
6666
* @param {string[]} commitMessages The commit messages to create the release body
6767
*/
68-
function prepareRelease(gren, tags, commitMessages) {
68+
function prepareRelease(gren, tagName, commitMessages) {
6969
var body = commitMessages
7070
.slice(0, -1)
7171
.filter(function (message) {
@@ -75,8 +75,8 @@ function prepareRelease(gren, tags, commitMessages) {
7575
.join('\n');
7676

7777
var releaseOptions = {
78-
tag_name: tags[0].name,
79-
name: (gren.options.prefix || '') + tags[0].name,
78+
tag_name: tagName,
79+
name: (gren.options.prefix || '') + tagName,
8080
body: body,
8181
draft: gren.options.draft || false,
8282
prerelease: gren.options.prerelease || false
@@ -216,6 +216,7 @@ function GithubReleaseNotes(options) {
216216
*/
217217
GithubReleaseNotes.prototype.release = function() {
218218
var that = this;
219+
var tagName;
219220

220221
return getLatestRelease(this)
221222
.then(function (releaseTagName) {
@@ -226,13 +227,15 @@ GithubReleaseNotes.prototype.release = function() {
226227
throw new Error('The latest tag is the latest release!');
227228
}
228229

230+
tagName = tags[0].name;
231+
229232
return Promise.all(getTagDates(that, tags[0], tags[1]));
230233
})
231234
.then(function (data) {
232235
return getCommitsBetweenTwo(that, data[1], data[0]);
233236
})
234237
.then(function (commitMessages) {
235-
return prepareRelease(that, tags, commitMessages);
238+
return prepareRelease(that, tagName, commitMessages);
236239
})
237240
.then(function (success) {
238241
return success;

0 commit comments

Comments
 (0)