Skip to content

Commit 41c536a

Browse files
feat: add url only input option
1 parent 668f251 commit 41c536a

File tree

5 files changed

+30
-7
lines changed

5 files changed

+30
-7
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ Only create an issue if the content matches the specified [regular expression](h
5656

5757
To _exclude_ items based on their content, you can use a negative lookahead. For example, to filter out all feed items whose text contains "TEST", use a regular expression like `/^(?!.*TEST)/`.
5858

59+
### `url-only`
60+
61+
If set, only the URL is added to the issue body
62+
5963
## Outputs
6064

6165
### `issues`
@@ -96,6 +100,7 @@ jobs:
96100
dry-run: false
97101
max-age: 48h
98102
labels: git
103+
url-only: false
99104
```
100105
101106
### Real Usage

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ inputs:
2828
description: "Limit to feed items whose titles match this regular expression"
2929
content-pattern:
3030
description: "Limit to feed items whose contents match this regular expression"
31+
url-only:
32+
description: "If set, only the URL is added to the issue body"
33+
default: 'false'
34+
required: false
3135
outputs:
3236
issues:
3337
description: "issue IDs, comma separated"

dist/index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,21 @@ const parseDurationInMilliseconds = (text) => {
2828

2929
const 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

@@ -103,7 +110,7 @@ const run = async () => {
103110
}
104111

105112
// Render issue content
106-
const body = `${markdown || ''}\n${item.link ? `\n${item.link}` : ''}`
113+
const body = urlOnly ? item.link : `${markdown || ''}\n${item.link ? `\n${item.link}` : ''}`
107114

108115
// Default to creating an issue per item
109116
// Create first issue if aggregate

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,21 @@ const parseDurationInMilliseconds = (text) => {
2222

2323
const run = async () => {
2424
try {
25-
let issueTitlePrefix = core.getInput('prefix')
26-
issueTitlePrefix = issueTitlePrefix ? issueTitlePrefix + ' ' : ''
25+
// boolean inputs
2726
let dryRun = core.getInput('dry-run')
2827
if (dryRun) dryRun = dryRun === 'true'
2928
let aggregate = core.getInput('aggregate')
3029
if (aggregate) aggregate = aggregate === 'true'
30+
let urlOnly = core.getInput('url-only')
31+
if (urlOnly) urlOnly = urlOnly === 'true'
32+
33+
// integer inputs
3134
let characterLimit = core.getInput('character-limit')
3235
if (characterLimit) characterLimit = parseInt(characterLimit)
36+
37+
// string inputs
38+
let issueTitlePrefix = core.getInput('prefix')
39+
issueTitlePrefix = issueTitlePrefix ? issueTitlePrefix + ' ' : ''
3340
const titlePattern = core.getInput('title-pattern')
3441
const contentPattern = core.getInput('content-pattern')
3542

@@ -97,7 +104,7 @@ const run = async () => {
97104
}
98105

99106
// Render issue content
100-
const body = `${markdown || ''}\n${item.link ? `\n${item.link}` : ''}`
107+
const body = urlOnly ? item.link : `${markdown || ''}\n${item.link ? `\n${item.link}` : ''}`
101108

102109
// Default to creating an issue per item
103110
// Create first issue if aggregate

0 commit comments

Comments
 (0)