Skip to content

Fix cURL rc version exclusion #89

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

Open
wants to merge 3 commits 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
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
})
})
11 changes: 8 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,16 @@ 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 && item.pubDate) item.title = new Date(item.pubDate).toUTCString()
if (!item.title) {
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}`

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

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

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,16 @@ 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 && item.pubDate) item.title = new Date(item.pubDate).toUTCString()
if (!item.title) {
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}`

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

Expand Down