Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter by commitish regardless of the refs/heads prefix #1089

Merged
merged 1 commit into from Mar 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion dist/index.js
Expand Up @@ -129086,8 +129086,14 @@ const findReleases = async ({

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

// `refs/heads/branch` and `branch` are the same thing in this context
const headRefRegex = /^refs\/heads\//
const targetCommitishName = targetCommitish.replace(headRefRegex, '')
const filteredReleases = filterByCommitish
? releases.filter((r) => targetCommitish.match(`/${r.target_commitish}$`))
? releases.filter(
(r) =>
targetCommitishName === r.target_commitish.replace(headRefRegex, '')
)
: releases
const sortedPublishedReleases = sortReleases(
filteredReleases.filter((r) => !r.draft)
Expand Down
8 changes: 7 additions & 1 deletion lib/releases.js
Expand Up @@ -43,8 +43,14 @@ const findReleases = async ({

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

// `refs/heads/branch` and `branch` are the same thing in this context
const headRefRegex = /^refs\/heads\//
const targetCommitishName = targetCommitish.replace(headRefRegex, '')
const filteredReleases = filterByCommitish
? releases.filter((r) => targetCommitish.match(`/${r.target_commitish}$`))
? releases.filter(
(r) =>
targetCommitishName === r.target_commitish.replace(headRefRegex, '')
)
: releases
const sortedPublishedReleases = sortReleases(
filteredReleases.filter((r) => !r.draft)
Expand Down