Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Log issue creation but do nothing

Aggregate all items in a single issue

Note: If you use this Action to create issues from multiple aggregated feeds in the same repository, give them different prefixes and/or labels.

### `character-limit`

Limit the issue contents' size
Expand Down
12 changes: 9 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38259,7 +38259,8 @@ const parseDurationInMilliseconds = (text) => {

const run = async () => {
try {
const issueTitlePrefix = core.getInput('prefix')
let issueTitlePrefix = core.getInput('prefix')
issueTitlePrefix = issueTitlePrefix ? issueTitlePrefix + ' ' : ''
let dryRun = core.getInput('dry-run')
if (dryRun) dryRun = dryRun === 'true'
let aggregate = core.getInput('aggregate')
Expand Down Expand Up @@ -38299,7 +38300,7 @@ const run = async () => {

// Iterate
for (const item of feed.items) {
let title = `${issueTitlePrefix ? issueTitlePrefix + ' ' : ''}${item.title}`
let title = `${issueTitlePrefix}${item.title}`
if (titlePattern && !title.match(titlePattern)) {
core.debug(`Feed item skipped because it does not match the title pattern (${title})`)
continue
Expand All @@ -38312,6 +38313,11 @@ const run = async () => {
continue
}

if (aggregate && issues.find(x => x.title.startsWith(issueTitlePrefix) && Date.parse(x.created_at) > Date.parse(item.isoDate))) {
core.warning('Newer issue with same prefix already exists')
continue
}

// Issue Content
const content = item.content || item.description || ''

Expand All @@ -38336,7 +38342,7 @@ const run = async () => {
// Create Issue
createdIssues.push({ title, body, labels })
} else {
title = `${issueTitlePrefix ? issueTitlePrefix + ' ' : ''}${new Date().toTimeString()}`
title = `${issueTitlePrefix}${new Date().toTimeString()}`
createdIssues[0].title = title

createdIssues[0].body += `\n\n${body}`
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const parseDurationInMilliseconds = (text) => {

const run = async () => {
try {
const issueTitlePrefix = core.getInput('prefix')
let issueTitlePrefix = core.getInput('prefix')
issueTitlePrefix = issueTitlePrefix ? issueTitlePrefix + ' ' : ''
let dryRun = core.getInput('dry-run')
if (dryRun) dryRun = dryRun === 'true'
let aggregate = core.getInput('aggregate')
Expand Down Expand Up @@ -62,7 +63,7 @@ const run = async () => {

// Iterate
for (const item of feed.items) {
let title = `${issueTitlePrefix ? issueTitlePrefix + ' ' : ''}${item.title}`
let title = `${issueTitlePrefix}${item.title}`
if (titlePattern && !title.match(titlePattern)) {
core.debug(`Feed item skipped because it does not match the title pattern (${title})`)
continue
Expand All @@ -75,6 +76,11 @@ const run = async () => {
continue
}

if (aggregate && issues.find(x => x.title.startsWith(issueTitlePrefix) && Date.parse(x.created_at) > Date.parse(item.isoDate))) {
core.warning('Newer issue with same prefix already exists')
continue
}

// Issue Content
const content = item.content || item.description || ''

Expand All @@ -99,7 +105,7 @@ const run = async () => {
// Create Issue
createdIssues.push({ title, body, labels })
} else {
title = `${issueTitlePrefix ? issueTitlePrefix + ' ' : ''}${new Date().toTimeString()}`
title = `${issueTitlePrefix}${new Date().toTimeString()}`
createdIssues[0].title = title

createdIssues[0].body += `\n\n${body}`
Expand Down