@@ -28,14 +28,21 @@ const parseDurationInMilliseconds = (text) => {
2828
2929const run = async () => {
3030 try {
31- let issueTitlePrefix = core.getInput('prefix')
32- issueTitlePrefix = issueTitlePrefix ? issueTitlePrefix + ' ' : ''
31+ // boolean inputs
3332 let dryRun = core.getInput('dry-run')
3433 if (dryRun) dryRun = dryRun === 'true'
3534 let aggregate = core.getInput('aggregate')
3635 if (aggregate) aggregate = aggregate === 'true'
36+ let urlOnly = core.getInput('url-only')
37+ if (urlOnly) urlOnly = urlOnly === 'true'
38+
39+ // integer inputs
3740 let characterLimit = core.getInput('character-limit')
3841 if (characterLimit) characterLimit = parseInt(characterLimit)
42+
43+ // string inputs
44+ let issueTitlePrefix = core.getInput('prefix')
45+ issueTitlePrefix = issueTitlePrefix ? issueTitlePrefix + ' ' : ''
3946 const titlePattern = core.getInput('title-pattern')
4047 const contentPattern = core.getInput('content-pattern')
4148
@@ -49,7 +56,18 @@ const run = async () => {
4956 const octokit = getOctokit(core.getInput('github-token'))
5057
5158 // Instantiate feed parser
52- const feed = await (new RSSParser({ xml2js: { trim: true } })).parseURL(core.getInput('feed'))
59+ const rssParserOptions = {
60+ headers: {
61+ 'User-Agent': 'rss-parser',
62+ 'Accept': 'application/rss+xml',
63+ // do not keep the connection alive
64+ 'Connection': 'close',
65+ },
66+ xml2js: {
67+ trim: true
68+ }
69+ }
70+ const feed = await (new RSSParser(rssParserOptions)).parseURL(core.getInput('feed'))
5371 core.info(feed && feed.title)
5472 if (!feed.items || feed.items.length === 0) return
5573
@@ -103,7 +121,7 @@ const run = async () => {
103121 }
104122
105123 // Render issue content
106- const body = `${markdown || ''}\n${item.link ? `\n${item.link}` : ''}`
124+ const body = urlOnly ? item.link : `${markdown || ''}\n${item.link ? `\n${item.link}` : ''}`
107125
108126 // Default to creating an issue per item
109127 // Create first issue if aggregate
@@ -7980,7 +7998,8 @@ class Parser {
79807998 let timeout = null;
79817999 let prom = new Promise((resolve, reject) => {
79828000 const requestOpts = Object.assign({headers}, urlParts, this.options.requestOptions);
7983- let req = get(requestOpts, (res) => {
8001+ let req
8002+ req = get(requestOpts, (res) => {
79848003 if (this.options.maxRedirects && res.statusCode >= 300 && res.statusCode < 400 && res.headers['location']) {
79858004 if (redirectCount === this.options.maxRedirects) {
79868005 return reject(new Error("Too many redirects"));
@@ -7997,6 +8016,7 @@ class Parser {
79978016 xml += chunk;
79988017 });
79998018 res.on('end', () => {
8019+ req.end()
80008020 return this.parseString(xml).then(resolve, reject);
80018021 });
80028022 })
0 commit comments