fix(post): fix target_commitish to be the default branch
target_commitish in GitHub Releases has two different meanings: * Target commit that a new associated tag will be created on * Target branch to compute how many "commits to since this release" target_commitish is usually the default branch (aka master), because the distance between the release and the latest branch is the primary concern. Before this change, target_commitish was left to be a hash and the feature of GitHub Releases that shows how much time passed since the release is ruined, because no tracking branch is given. By this change, target_commitish is changed to be the default branch given in the configuration (options.branch) via edit a release API after the release and tag are created via crate a release API.
This commit is contained in:
parent
5b3bdd226f
commit
f148a61339
14
src/post.js
14
src/post.js
@ -43,11 +43,23 @@ module.exports = function (config, cb) {
|
||||
token: options.githubToken
|
||||
})
|
||||
|
||||
github.repos.createRelease(release, function (err) {
|
||||
github.repos.createRelease(release, function (err, res) {
|
||||
if (err) return cb(err)
|
||||
if (options.debug) return cb(null, true, release)
|
||||
|
||||
var editingRelease = {
|
||||
owner: ghRepo[0],
|
||||
repo: ghRepo[1],
|
||||
id: res.id,
|
||||
target_commitish: options.branch
|
||||
}
|
||||
|
||||
github.repos.editRelease(editingRelease, function (err) {
|
||||
if (err) return cb(err)
|
||||
|
||||
cb(null, true, release)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
@ -5,6 +5,9 @@ module.exports = function () {
|
||||
},
|
||||
repos: {
|
||||
createRelease: function (release, cb) {
|
||||
cb(null, {id: 1})
|
||||
},
|
||||
editRelease: function (release, cb) {
|
||||
cb(null)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user