gautamkrishnar / blog-post-workflow

Show your latest blog posts from any sources or StackOverflow activity or Youtube Videos on your GitHub profile/project readme automatically using the RSS feed
https://github.com/marketplace/actions/blog-post-workflow
GNU Affero General Public License v3.0
3.02k stars 269 forks source link

[Bug]: TypeError: Cannot convert object to primitive value #208

Closed RobThree closed 1 year ago

RobThree commented 1 year ago

Describe the bug I'm getting Error: TypeError: Cannot convert object to primitive value.

Expected behavior I expected the RSS feed to load and be processed correctly 😃

Screenshots

Screenshot 2023-04-15 at 11 18 41

Workflow Yml Used

name: Latest blog post workflow
on:
  schedule: # Run workflow automatically
    - cron: '0 0 * * *' # Runs every midnight
  workflow_dispatch: # Run workflow manually (without waiting for the cron to be called), through the Github Actions Workflow page directly

jobs:
  update-readme-with-blog:
    name: Update this repo's README with latest blog posts
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Pull in posts
        uses: gautamkrishnar/blog-post-workflow@master
        with:
          feed_list: "https://blog.robiii.nl/feeds/posts/default?alt=rss"
          template: "<li><a href=\"$url\" target=\"_blank\" title=\"UTC: $date\">$title</li>"
          max_post_count: 10

Additional context Here is the debug log:

##[debug]Evaluating condition for step: 'Pull in posts'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Pull in posts
##[debug]Loading inputs
##[debug]Evaluating: github.token
##[debug]Evaluating Index:
##[debug]..Evaluating github:
##[debug]..=> Object
##[debug]..Evaluating String:
##[debug]..=> 'token'
##[debug]=> '***'
##[debug]Result: '***'
##[debug]Loading env
Run gautamkrishnar/blog-post-workflow@master
  with:
    feed_list: https://blog.robiii.nl/feeds/posts/default?alt=rss
    template: <li><a href="$url" target="_blank" title="UTC: $date">$title</li>
    max_post_count: 10
    gh_token: ***
    readme_path: ./README.md
    disable_sort: false
    filter_comments: medium,stackoverflow/Comment by $author/,stackexchange/Comment by $author/
    date_format: UTC:ddd mmm dd yyyy h:MM TT
    user_agent: rss-parser
    accept_header: application/rss+xml
    commit_message: Updated with the latest blog posts
    committer_username: blog-post-bot
    committer_email: blog-post-bot@example.com
    output_only: false
    enable_keepalive: true
    retry_count: 0
    retry_wait_time: 1
    disable_html_encoding: false
    categories_template: default
    disable_item_validation: false
    skip_commit: false
::add-mask::***
https://blog.robiii.nl/feeds/posts/default?alt=rss runner succeeded. Post count: [2](https://github.com/RobThree/RobThree/actions/runs/4705071732/jobs/8348709833#step:3:2)[4](https://github.com/RobThree/RobThree/actions/runs/4705071732/jobs/8348709833#step:3:4)
Error: TypeError: Cannot convert object to primitive value
##[debug]Node Action run completed with exit code 1
##[debug]Finishing: Pull in posts

I have no idea what the Cannot convert object to primitive value is referring to. I hope you can point me in the right direction or instruct me how to debug this issue.

Thanks!

gautamkrishnar commented 1 year ago

@RobThree this is mainly due to this:

         <category domain="http://www.blogger.com/atom/ns#">C#</category>
         <category domain="http://www.blogger.com/atom/ns#">Controller</category>
         <category domain="http://www.blogger.com/atom/ns#">Ordering</category>
         <category domain="http://www.blogger.com/atom/ns#">Sorting</category>
         <category domain="http://www.blogger.com/atom/ns#">Swagger</category>
         <category domain="http://www.blogger.com/atom/ns#">Swashbuckle</category>

your RSS feed is sending categories like this

RobThree commented 1 year ago

Ok. I'm sorry for my ignorance, but, what should it look like / be then?

gautamkrishnar commented 1 year ago

@RobThree nevermind, I just read through the RSS spec docs looks like this is also a valid case. Will try to add a fix for this. https://validator.w3.org/feed/docs/rss2.html#ltcategorygtSubelementOfLtitemgt

RobThree commented 1 year ago

That would be amazing! Thank you! Much appreciated!

(Also: I think blogger must've changed something yesterday then - I haven't changed anything)

gautamkrishnar commented 1 year ago

@RobThree fix for this is now released on https://github.com/gautamkrishnar/blog-post-workflow/releases/tag/1.8.4 Thanks for reporting this. There is no action is required from your end it will automatically work the next time when it runs.

RobThree commented 1 year ago
Screenshot 2023-04-15 at 18 07 07

All green! 🚀

Thanks! That was amazing and super quick! Much appreciated!