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

feat: add tagFilter setting #49

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ inputs:
description: Maximum number of tags to fetch from latest.
required: false
default: '10'
tagFilter:
description: Regex pattern used to filter out tags that should be ignored.
required: false
outputs:
current:
description: Current version number / latest tag.
Expand Down
13 changes: 13 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52962,6 +52962,7 @@ async function main () {
const fromTag = core.getInput('fromTag')
const maxTagsToFetch = _.toSafeInteger(core.getInput('maxTagsToFetch') || 10)
const fetchLimit = (maxTagsToFetch < 1 || maxTagsToFetch > 100) ? 10 : maxTagsToFetch
const tagFilter = core.getInput('tagFilter')

const bumpTypes = {
major: core.getInput('majorList').split(',').map(p => p.trim()).filter(p => p),
Expand Down Expand Up @@ -53022,7 +53023,19 @@ async function main () {
}

let idx = 0

if (tagFilter) {
console.log('Will filter out tags that match: ' + tagFilter)
}

for (const tag of tagsList) {
if (tagFilter) {
if (new RegExp(tagFilter).test(tag.name)) {
console.log(`Skipping tag "${tag.name}" (matches tagFilter)`)
continue
}
}

if (prefix) {
if (tag.name.indexOf(prefix) === 0) {
tag.name = tag.name.replace(prefix, '')
Expand Down
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ async function main () {
const fromTag = core.getInput('fromTag')
const maxTagsToFetch = _.toSafeInteger(core.getInput('maxTagsToFetch') || 10)
const fetchLimit = (maxTagsToFetch < 1 || maxTagsToFetch > 100) ? 10 : maxTagsToFetch
const tagFilter = core.getInput('tagFilter')

const bumpTypes = {
major: core.getInput('majorList').split(',').map(p => p.trim()).filter(p => p),
Expand Down Expand Up @@ -78,7 +79,19 @@ async function main () {
}

let idx = 0

if (tagFilter) {
console.log('Will filter out tags that match: ' + tagFilter)
}

for (const tag of tagsList) {
if (tagFilter) {
if (new RegExp(tagFilter).test(tag.name)) {
console.log(`Skipping tag "${tag.name}" (matches tagFilter)`)
continue
}
}

if (prefix) {
if (tag.name.indexOf(prefix) === 0) {
tag.name = tag.name.replace(prefix, '')
Expand Down