Skip to content

Commit

Permalink
Merge pull request #682 from release-drafter/revert-657-master
Browse files Browse the repository at this point in the history
Revert "filter releases to consider only the target branch "
  • Loading branch information
jetersen committed Oct 20, 2020
2 parents b9f2371 + 660486c commit a3b34cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -33,7 +33,7 @@ module.exports = (app) => {
return
}

const { draftRelease, lastRelease } = await findReleases({ ref, app, context })
const { draftRelease, lastRelease } = await findReleases({ app, context })
const {
commits,
pullRequests: mergedPullRequests,
Expand Down
9 changes: 4 additions & 5 deletions lib/releases.js
Expand Up @@ -17,7 +17,7 @@ const sortReleases = (releases) => {
}
}

module.exports.findReleases = async ({ ref, app, context }) => {
module.exports.findReleases = async ({ app, context }) => {
let releases = await context.github.paginate(
context.github.repos.listReleases.endpoint.merge(
context.repo({
Expand All @@ -27,10 +27,9 @@ module.exports.findReleases = async ({ ref, app, context }) => {
)

log({ app, context, message: `Found ${releases.length} releases` })

const filteredReleases = releases.filter((r) => ref.match(`/${r.target_commitish}$`))
const sortedPublishedReleases = sortReleases(filteredReleases.filter((r) => !r.draft))
const draftRelease = filteredReleases.find((r) => r.draft)

const sortedPublishedReleases = sortReleases(releases.filter((r) => !r.draft))
const draftRelease = releases.find((r) => r.draft)
const lastRelease =
sortedPublishedReleases[sortedPublishedReleases.length - 1]

Expand Down

0 comments on commit a3b34cc

Please sign in to comment.