Automatically update your GitHub readme through GitHub Actions

Pawel Grzybek has set up a workflow that uses GitHub Actions’ Scheduled Events to automatically update his profile README.md. It runs every 6 hours and pulls in his RSS feed to populate the README.md

import fs from "fs";
import fetch from "node-fetch";
import parser from "xml2json";

const FEED_URL = "https://pawelgrzybek.com/feed.xml";
const TAG_OPEN = `<!-- FEED-START -->`;
const TAG_CLOSE = `<!-- FEED-END -->`;

const fetchArticles = async () => {
  const articles = await fetch(FEED_URL);
  const articlesText = await articles.text();
  const articlesJSON = parser.toJson(articlesText);
  const newC = JSON.parse(articlesJSON).rss.channel.item.slice(0, 5);

  return newC.map(({ title, link }) => `- [${title}](${link})`).join("\n");
};

async function main() {
  const readme = fs.readFileSync("./README.md", "utf8");
  const indexBefore = readme.indexOf(TAG_OPEN) + TAG_OPEN.length;
  const indexAfter = readme.indexOf(TAG_CLOSE);
  const readmeContentChunkBreakBefore = readme.substring(0, indexBefore);
  const readmeContentChunkBreakAfter = readme.substring(indexAfter);

  const posts = await fetchArticles();

  const readmeNew = `
${readmeContentChunkBreakBefore}
${posts}
${readmeContentChunkBreakAfter}
`;

  fs.writeFileSync("./README.md", readmeNew.trim());
}

try {
  main();
} catch (error) {
  console.error(error);
}

Fetch most recent posts to your GitHub profile page using GitHub workflow and Node.js →

πŸ’‘ People have been doing lots of nice stuff with their README’s. There’s a curated list to be found at matiassingers/awesome-readme (and plenty of others if you search for them)

RSS Feeds for GitHub Project Releases and User Activity

As an extra to RSS feed for youtube channels and GitHub projects, Pawel notes that it’s also possible to get a feed for the releases published in GitHub Projects.

GitHub gives us RSS feeds for project releases and tags. Thats my preferred way of finding out about my followed projects fixed bugs and new features.

https://github.com/{{username}}/{{repository}}/releases.atom
https://github.com/{{username}}/{{repository}}/tags.atom

Ah, that I didn’t know!

I noticed that this also works for user activity feeds btw. Just like you can append .keys to any GitHub User Profile Page to see their public keys, you can append .atom to get their (public) activity feed.

https://github.com/{{username}}.atom

Here’s my activity feed for example: https://github.com/bramus.atom

RSS feed for youtube channels and GitHub projects →

JSON Feed

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.

So we developed JSON Feed, a format similar to RSS and Atom but in JSON. It reflects the lessons learned from our years of work reading and publishing feeds.

The format itself is very easy to read/interpret:

{
    "version": "https://jsonfeed.org/version/1",
    "title": "My Example Feed",
    "home_page_url": "https://example.org/",
    "feed_url": "https://example.org/feed.json",
    "items": [
        {
            "id": "2",
            "content_text": "This is a second item.",
            "url": "https://example.org/second-item"
        },
        {
            "id": "1",
            "content_html": "<p>Hello, world!</p>",
            "url": "https://example.org/initial-post"
        }
    ]
}

A plugin for WordPress is also available.

Announcing JSON Feed →
JSON Feed Plugin for WordPress →

(via β˜…)

Tiny Tiny RSS

Update 2013.03.18: Just took Tiny Tiny RSS for a spin. It works as advertised (it collects your feeds and you can stroll through them), but I found it not that great (the concept of the reading pane just doesn’t work, some frontend bugs, couldn’t get the authentication plugin to work although it was enabled, etc.).

I also took a look at the underlying PHP code and it’s very worrisome β€” it looks like my PHP code from 10 years ago. Above that the project contains some half-assed attempts such as the digest mode and mobile mode (which are not implemented correctly) which got me worrying even more about the quality of the product.

Guess I’ll have to look for an other alternative …

site_shot_5

Google recently announced that they’ll be shutting down Google Reader on July 1st. One alternative that’s been suggested to me is Tiny Tiny RSS.

Tiny Tiny RSS is an open source web-based news feed (RSS/Atom) reader and aggregator, designed to allow you to read news from any location, while feeling as close to a real desktop application as possible.

Don’t like the look and feel but might give it a shot …

Tiny Tiny RSS →

Note: Digg announced that they’ll be making a Digg Reader … now, must say they’ve made me curious.

Introducing BramVanDamme.be

Bram Van DammeBram.us always went along with the tagline “Days in the Life of a Geezer named Bramus!” As of last week this is no more as this site doesn’t fully track my online trail as – next to this blog – I’m blogging on Nieuw in Gent, tweeting all day long, uploading pics to flickr, bookmarking on del.icio.us, listening to music, etc.

Continue reading “Introducing BramVanDamme.be”