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
62 changes: 62 additions & 0 deletions __tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,65 @@ Signed-off-by: Johannes Schindelin <[email protected]>
https://github.com/git-for-windows/rss-to-issues/commit/394ee852b18c5e3bca536b585cbb95d32ce77057`
})
})

test('curl -rc versions', async () => {
mockHTTPSGet.__RETURN__ = `<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
<id>tag:github.com,2008:https://github.com/curl/curl/releases</id>
<link type="text/html" rel="alternate" href="https://github.com/curl/curl/releases"/>
<link type="application/atom+xml" rel="self" href="https://github.com/curl/curl/releases.atom"/>
<title>Tags from curl</title>
<updated>2025-06-30T11:34:35Z</updated>
<entry>
<id>tag:github.com,2008:Repository/569041/rc-8_15_0-2</id>
<updated>2025-06-30T11:34:35Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/curl/curl/releases/tag/rc-8_15_0-2"/>
<title>rc-8_15_0-2</title>
<content></content>
<author>
<name>bagder</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/177011?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/569041/rc-8_15_0-1</id>
<updated>2025-06-21T09:50:00Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/curl/curl/releases/tag/rc-8_15_0-1"/>
<title>rc-8_15_0-1</title>
<content></content>
<author>
<name>bagder</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/177011?s=60&amp;v=4"/>
</entry>
<entry>
<id>tag:github.com,2008:Repository/569041/curl-8_14_1</id>
<updated>2025-06-04T05:59:07Z</updated>
<link rel="alternate" type="text/html" href="https://github.com/curl/curl/releases/tag/curl-8_14_1"/>
<title>8.14.1</title>
<content></content>
<author>
<name>bagder</name>
</author>
<media:thumbnail height="30" width="30" url="https://avatars.githubusercontent.com/u/177011?s=60&amp;v=4"/>
</entry>
</feed>`
octokit.rest.issues.listForRepo.mockReturnValueOnce({ data: [] })
Object.assign(core.__INPUTS__, {
'max-age': '9999d',
prefix: '[New curl version]',
'title-pattern': '^(?!rc-)'
})
await run()

expect(https.get).toHaveBeenCalledTimes(1)
expect(octokit.rest.issues.listForRepo).toHaveBeenCalledTimes(1)
expect(octokit.rest.issues.create).toHaveBeenCalledTimes(1)
expect(octokit.rest.issues.create).toHaveBeenCalledWith({
owner: 'owner',
repo: 'repo',
title: '[New curl version] 8.14.1',
body: '\n\nhttps://github.com/curl/curl/releases/tag/curl-8_14_1',
labels: undefined
})
})
10 changes: 7 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,15 @@ const run = async () => {
// Iterate
let counter = 0
for (const item of feed.items) {
const title = `${issueTitlePrefix}${item.title || (item.pubDate && new Date(item.pubDate).toUTCString())}`
if (titlePattern && !title.match(titlePattern)) {
core.debug(`Feed item skipped because it does not match the title pattern (${title})`)
if (!item.title && (titlePattern || !item.pubDate)) {
core.debug(`Feed item ${JSON.stringify(item)} skipped because it has no title`)
continue
}
if (titlePattern && !item.title.match(titlePattern)) {
core.debug(`Feed item skipped because it does not match the title pattern (${item.title})`)
continue
}
const title = `${issueTitlePrefix}${item.title || new Date(item.pubDate).toUTCString()}`

core.debug(`Issue '${title}'`)

Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ const run = async () => {
// Iterate
let counter = 0
for (const item of feed.items) {
const title = `${issueTitlePrefix}${item.title || (item.pubDate && new Date(item.pubDate).toUTCString())}`
if (titlePattern && !title.match(titlePattern)) {
core.debug(`Feed item skipped because it does not match the title pattern (${title})`)
if (!item.title && (titlePattern || !item.pubDate)) {
core.debug(`Feed item ${JSON.stringify(item)} skipped because it has no title`)
continue
}
if (titlePattern && !item.title.match(titlePattern)) {
core.debug(`Feed item skipped because it does not match the title pattern (${item.title})`)
continue
}
const title = `${issueTitlePrefix}${item.title || new Date(item.pubDate).toUTCString()}`

core.debug(`Issue '${title}'`)

Expand Down