Track your books with GitHub Actions

Track your books with GitHub Actions

I built read action, a GitHub Action, that tracks the books that you’ve read by storing the book metadata in a yaml file. Services like Goodreads exist, but I want to own my data.

How it works

After I finish a book, I create an issue in my site repository, enter the ISBN as the title, and add the read label. Once I open the issue the GitHub action kicks off.

  1. The action parses the issue title to extract the ISBN.
  2. Then it uses node-isbn to return the metadata for the book. If I added any content to the body of the issue, the action will set it as the value of notes in the book entry. The action will also set the dateFinished to today, unless I specify a YYYY-MM-DD value in the title of the issue.
  3. As a last step, the action fetches my repository’s library (_data/read.yml), adds the book entry, orders all entries by dateFinished, and rewrites the file.

Finally, the workflow commits the changes and closes the issue.

Try read action

Pair it with an iOS Shortcut

I created a Shortcut to help me automate issue creation from my iPhone.

When I click the Finished a book Shortcut, it asks me: What’s the ISBN?, When did you finish the book? and Any notes? Using the responses, the shortcut will then use GitHub’s create an issue endpoint and open the issue in my set repository.

Add the Finished a book iOS Shortcut

You will likely need to allow untrusted shortcuts to be able to add the shortcut. (But you should review the shortcut steps to make sure you understand all the actions it will take.)

Display your library

Since the file is a Jekyll data file, I can list all the books that I read this year.

  • Charlotte Walsh Likes To Win
  • Difficult Women
  • Men Explain Things to Me
  • Trick Mirror
  • This Naked Mind
  • Dept. of Speculation
  • Big Friendship
  • Normal People
  • I Might Regret This
  • The Vanishing Half
  • I'll Be Gone in the Dark
  • Luster
  • Transcendent Kingdom
  • Saratoga Soul Brandtville Blues
  • Expressive Design Systems
  • Practical Pair Programming
  • Not That Bad
  • How to Do Nothing
  • Uncanny Valley
  • The Mercies
  • Black Futures
  • We Have Always Lived in the Castle

I read 22 books in 2020 (so far).

{% assign sorted = site.data.read | sort: 'dateFinished' | where_exp:"item",
"item.dateFinished contains 2020" %}

<ul class="books">
{% for book in sorted %}
  <li>
    <a href="{{book.canonicalVolumeLink}}" class="book"><img src="{{book.imageLinks.thumbnail}}" alt="{{book.title}}"></a>
  </li>
{% endfor %}
</ul>

I read {{sorted | size}} books in 2020 (so far).

Did you enjoy this post? Support Black Girls Code. Black Girls Code's empowers young women of color ages 7-17 to embrace the current tech marketplace as builders and creators.