Skip to content

Commit

Permalink
#620: Filter updates that are drafts or prereleases
Browse files Browse the repository at this point in the history
  • Loading branch information
pirog committed Jan 26, 2018
1 parent 4b22f1d commit 157d876
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,24 @@ exports.refresh = function(version) {
owner: 'lando',
repo: 'lando',
page: 1,
'per_page': 1
'per_page': 10
};

// This i promise you
return github.repos.getReleases(landoRepoConfig)

// Extract and return the metadata
.then(function(data) {

// Get the latest non-draft/non-prerelease version
data = _.find(_.get(data, 'data', []), function(release) {
return (release.draft === false && release.prerelease === false);
});

// Return the update data
return {
version: _.trimStart(_.get(data, 'data.[0].tag_name', version), 'v'),
url: _.get(data, 'data.[0].html_url', ''),
version: _.trimStart(_.get(data, 'tag_name', version), 'v'),
url: _.get(data, 'html_url', ''),
expires: Math.floor(Date.now()) + 3600000
};
})
Expand Down

0 comments on commit 157d876

Please sign in to comment.