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

Added support for different feed types #3

Merged
merged 4 commits into from
Sep 29, 2023
Merged
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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

## Introduction

The RSS Feed Fetch Action is a GitHub Action that fetches an RSS feed from a given URL and saves it to a specified file. It's designed to be a simple yet powerful tool for automating the process of fetching and storing RSS feeds in your GitHub repository for deployment to a Github Pages website.
The RSS Feed Fetch Action is a GitHub Action that fetches an RSS feed from a given URL and saves it to a specified file. It is intended as a simple tool for automating the process of fetching and storing RSS feeds in your GitHub repository for deployment to a Github Pages website. In contrast to feed aggregators that force a bunch of different feeds into the same schema (often losing information along the way), RSS Feed Fetch fetches a single feed and handles and saves it in an unopinionated way.

The RSS Feed Fetch Action supports a variety of different feed types, including RSS 1.0, RSS 2.0, Atom, RDF, and JSON. It also supports saving the feed in either `.json` or `.xml` format. Since some RSS formats include a last build date, which changes frequently, the RSS Feed Fetch Action also supports removing the `lastBuildDate` tag from the fetched feed, which can be useful for preventing unnecessary commits to your repository.

## Features

Expand Down
30 changes: 30 additions & 0 deletions __tests__/data/atom-feed-standard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<feed
xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<subtitle>A subtitle.</subtitle>
<link href="http://example.org/feed/" rel="self" />
<link href="http://example.org/" />
<id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
<updated>2003-12-13T18:30:02Z</updated>
<entry>
<title>Atom-Powered Robots Run Amok</title>
<link href="http://example.org/2003/12/13/atom03" />
<link rel="alternate" type="text/html" href="http://example.org/2003/12/13/atom03.html"/>
<link rel="edit" href="http://example.org/2003/12/13/atom03/edit"/>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<published>2003-11-09T17:23:02Z</published>
<updated>2003-12-13T18:30:02Z</updated>
<summary>Some text.</summary>
<content type="xhtml">
<div
xmlns="http://www.w3.org/1999/xhtml">
<p>This is the entry content.</p>
</div>
</content>
<author>
<name>John Doe</name>
<email>[email protected]</email>
</author>
</entry>
</feed>
23 changes: 23 additions & 0 deletions __tests__/data/json-feed-standard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "https://jsonfeed.org/version/1",
"title": "JSON Feed",
"icon": "https://micro.blog/jsonfeed/avatar.jpg",
"home_page_url": "https://www.jsonfeed.org/",
"feed_url": "https://www.jsonfeed.org/feed.json",
"items": [
{
"id": "http://jsonfeed.micro.blog/2020/08/07/json-feed-version.html",
"title": "JSON Feed version 1.1",
"content_html": "<p>We&rsquo;ve updated the spec to <a href=\"https://jsonfeed.org/version/1.1\">version 1.1</a>. It’s a minor update to JSON Feed, clarifying a few things in the spec and adding a couple new fields such as <code>authors</code> and <code>language</code>.</p>\n\n<p>For version 1.1, we&rsquo;re starting to move to the more specific MIME type <code>application/feed+json</code>. Clients that parse HTML to discover feeds should prefer that MIME type, while still falling back to accepting <code>application/json</code> too.</p>\n\n<p>The <a href=\"https://jsonfeed.org/code/\">code page</a> has also been updated with several new code libraries and apps that support JSON Feed.</p>\n",
"date_published": "2020-08-07T11:44:36-05:00",
"url": "https://www.jsonfeed.org/2020/08/07/json-feed-version.html"
},
{
"id": "http://jsonfeed.micro.blog/2017/05/17/announcing-json-feed.html",
"title": "Announcing JSON Feed",
"content_html": "\n\n<p>We — Manton Reece and Brent Simmons — have noticed that JSON has become the developers’ choice for APIs, and that developers will often go out of their way to avoid XML. JSON is simpler to read and write, and it’s less prone to bugs.</p>\n\n<p>So we developed JSON Feed, a format similar to <a href=\"http://cyber.harvard.edu/rss/rss.html\">RSS</a> and <a href=\"https://tools.ietf.org/html/rfc4287\">Atom</a> but in JSON. It reflects the lessons learned from our years of work reading and publishing feeds.</p>\n\n<p><a href=\"https://jsonfeed.org/version/1\">See the spec</a>. It’s at version 1, which may be the only version ever needed. If future versions are needed, version 1 feeds will still be valid feeds.</p>\n\n<h4 id=\"notes\">Notes</h4>\n\n<p>We have a <a href=\"https://github.com/manton/jsonfeed-wp\">WordPress plugin</a> and, coming soon, a JSON Feed Parser for Swift. As more code is written, by us and others, we’ll update the <a href=\"https://jsonfeed.org/code\">code</a> page.</p>\n\n<p>See <a href=\"https://jsonfeed.org/mappingrssandatom\">Mapping RSS and Atom to JSON Feed</a> for more on the similarities between the formats.</p>\n\n<p>This website — the Markdown files and supporting resources — <a href=\"https://github.com/brentsimmons/JSONFeed\">is up on GitHub</a>, and you’re welcome to comment there.</p>\n\n<p>This website is also a blog, and you can subscribe to the <a href=\"https://jsonfeed.org/xml/rss.xml\">RSS feed</a> or the <a href=\"https://jsonfeed.org/feed.json\">JSON feed</a> (if your reader supports it).</p>\n\n<p>We worked with a number of people on this over the course of several months. We list them, and thank them, at the bottom of the <a href=\"https://jsonfeed.org/version/1\">spec</a>. But — most importantly — <a href=\"http://furbo.org/\">Craig Hockenberry</a> spent a little time making it look pretty. :)</p>\n",
"date_published": "2017-05-17T10:02:12-05:00",
"url": "https://www.jsonfeed.org/2017/05/17/announcing-json-feed.html"
}
]
}
Loading