Skip to content
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

feat: add url only input option #54

Merged

Conversation

ReenigneArcher
Copy link

@ReenigneArcher ReenigneArcher commented Jan 8, 2025

This PR adds a url-only input option. When set to true the issue body will contain only the item.link.

I additionally separated the inputs by type in the js, if this is not desirable I can revert that.

Lastly, I am not super familiar with node.js github actions, but I believe I had to run the build steps to get it to work as a github action (please let me know if I need to do something different to update dist). Edit: the workflow failed so I guess that answers that, but I don't know what I need to run to get it passing. I ran everything in the package.json already.

Fixes #53

@ReenigneArcher
Copy link
Author

ReenigneArcher commented Jan 8, 2025

It works:

Side note: The action takes a very long time. The issue is created almost immediately, but it keeps running for several minutes after that? My feed is very small, so not sure what's going on. Any idea?

@ReenigneArcher ReenigneArcher marked this pull request as ready for review January 8, 2025 01:43
dscho added a commit to dscho/rss-to-issues that referenced this pull request Jan 8, 2025
In git-for-windows#54 an issue was
identified where the Action seemed to take a ridiculously long time to
process a given feed URL. This new debug configuration makes it easy to
single-step through the code while accessing that feed.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho
Copy link
Member

dscho commented Jan 8, 2025

The action takes a very long time. The issue is created almost immediately, but it keeps running for several minutes after that? My feed is very small, so not sure what's going on. Any idea?

I am not exactly sure what is happening, but here are a couple of observations:

  • This issue seems not to happen with https://github.com/git-for-windows/git/actions/runs/12656277535, where regular GitHub API calls are used to obtain the XML content, therefore it may be somewhat specific to obtaining the content from GitHub Pages.

  • When I single-stepped through the Action (in VS Code, using INPUT_<upper-cased-input-name> environment variables and heavily editing the code to facilitate debugging), everything looked okay except for one thing: after "single-stepping" out of the run function in index.js, the process "hung" and I could not pause it nor see any stack trace.

  • This lead me to: Socket remains open after a timeout rbren/rss-parser#238, which I believe is at play here.

  • At least when I replace the .parseURL(core.getInput('feed')) call by .parseString(await (await fetch(core.getInput('feed'))).text()), the process exits immediately.

  • I actually played a little more with the thought and it looks as if this diff fixed things here (maybe you can give it a try?):

    diff --git a/index.js b/index.js
    index d14a503..3ca8eba 100644
    --- a/index.js
    +++ b/index.js
    @@ -50,7 +50,18 @@ const run = async () => {
         const octokit = getOctokit(core.getInput('github-token'))
     
         // Instantiate feed parser
    -    const feed = await (new RSSParser({ xml2js: { trim: true } })).parseURL(core.getInput('feed'))
    +    const rssParserOptions = {
    +      headers: {
    +        'User-Agent': 'rss-parser',
    +        'Accept': 'application/rss+xml',
    +        // do not keep the connection alive
    +        'Connection': 'close',
    +      },
    +      xml2js: {
    +        trim: true
    +      }
    +    }
    +    const feed = await (new RSSParser(rssParserOptions)).parseURL(core.getInput('feed'))
         core.info(feed && feed.title)
         if (!feed.items || feed.items.length === 0) return
     

    To make it easier, I push an updated branch to https://github.com/dscho/rss-to-issues/compare/feat/add-url-only-input-option (I tried to force-push to your branch, but you unchecked the "allow maintainers to update the branch" checkbox).

@ReenigneArcher
Copy link
Author

Nice, it completes in 1s now! I've enabled the option to allow edits by maintainers if you want to reset this branch to match yours (otherwise I can do it in a few hours).

@dscho dscho force-pushed the feat/add-url-only-input-option branch from 41c536a to 7628d99 Compare January 8, 2025 14:01
dscho added 2 commits January 8, 2025 15:04
The default e.g. with GitHub Pages seems to be to keep the connection
alive, which does not make sense here.

Signed-off-by: Johannes Schindelin <[email protected]>
In #54 an issue was
identified where the Action seemed to take a ridiculously long time to
process a given feed URL. This new debug configuration makes it easy to
single-step through the code while accessing that feed.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho force-pushed the feat/add-url-only-input-option branch from 7628d99 to fc7ab0f Compare January 8, 2025 14:05
Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho force-pushed the feat/add-url-only-input-option branch from fc7ab0f to dcf7587 Compare January 8, 2025 14:12
@dscho dscho linked an issue Jan 8, 2025 that may be closed by this pull request
@dscho dscho merged commit e7fd75b into git-for-windows:main Jan 8, 2025
1 check passed
@dscho
Copy link
Member

dscho commented Jan 8, 2025

@ReenigneArcher see https://github.com/git-for-windows/rss-to-issues/releases/tag/v0.0.10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to only post the url to the issue instead of the body?
2 participants