← Projects

brunosouzas

Python · MIT · Active

On this page

Code

Showing your site’s latest articles on your GitHub profile takes one script and one workflow. This is the repository of the brunosouzas profile, useful as an example of how to do it with RSS.

What it does

  • scripts/update_articles.py reads the site’s RSS feed, downloads each article’s cover, makes thumbnails and rewrites the list between two comments in the README. It uses only Python’s standard library.
  • A GitHub Actions workflow runs when the site publishes, once a day and on demand, and commits only when something changed.
  • The tests check the generated files.

Getting started

Copy to your profile repository the scripts/ folder (the script imports build_assets.py and glyphs.py), the fonts/ folder and the workflow; change the feed address and add the <!-- articles:start --> and <!-- articles:end --> comments to the README. For each item, the script expects a link ending in the article’s slug and the cover in media:content, as an SVG that depends on no external file.

python3 scripts/update_articles.py --feed https://example.com/rss.xml
python3 -m unittest discover -s tests

The MIT licence covers the code. The repository’s text, images, brand and fonts are excluded, as NOTICE.md says.

Code for this page