Giter Club home page Giter Club logo

goodreads-profile-workflow's Introduction

Goodreads profile workflow

Automatically update your README with what you're currently reading—or any other Goodreads reading shelf of yours.

goodreads-github-profile-update-v1

How to use

  • Go to your repository
  • Add the following section to your README.md file, you can give whatever title you want. Just make sure that you use <!-- GOODREADS-LIST:START --><!-- GOODREADS-LIST:END --> in your readme. The workflow will replace this comment with the actual list of currently reading books:
### Books I'm currently reading
<!-- GOODREADS-LIST:START -->
<!-- GOODREADS-LIST:END -->
  • Create a folder named .github and create a workflows folder inside it if it doesn't exist.
  • Create a new file named goodreads-profile-workflow.yml with the following contents inside the workflows folder:
name: Latest book list from a goodreads
on:
  schedule: # Run workflow automatically
    # This will make it run every hour
    - cron: "0 * * * *"
    # Run workflow manually (without waiting for the cron to be called), through the Github Actions Workflow page directly
  workflow_dispatch:
jobs:
  update-readme-with-goodreads-books:
    name: Update this repo's README with what you're currently reading
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: zwacky/goodreads-profile-workflow@main
        with:
          # Replace this with your goodreads user id
          goodreads_user_id: "92930971"
          shelf: "currently-reading"
  • Replace the above goodreads_user_id with yours. To find out your user ID go to "My Books" on Goodreads and you'll see it in the URL.
  • Commit and wait for it to run automatically or you can also trigger it manually to see the result instantly. To trigger the workflow manually check out this blog post by GitHub.

Inputs

Here are all the inputs you can change in your goodreads-profile-workflow.yml file under steps[*].with:

Option Default Value Description Required
goodreads_user_id "" The Goodreads account ID to fetch the books from. Yes
shelf "currently-reading" The Goodreads shelf/list the books are in (default shelves: currently-reading, read, to-read) No
max_books_count "10" Max count of books that will be taken from the shelf/list No
readme_file_path "./README.md" Path of the readme file you want to update No
output_only "false" Usually used together with local-run.js. Sets the generated array as books output variable so that it can be consumed in other actions No
comment_tag_name "GOODREADS-LIST" Overrides the default comment tag name (<!-- GOODREADS-LIST:START --><!-- GOODREADS-LIST:END -->). In case you want to run multiple instances over the same README No
template "- [$title]($url) by $author (⭐️$average_rating)" The list template written in Markdown.

Suported variables:
  • $title: Book title
  • $url: Goodreads URL of the book
  • $author: Book author
  • $published_year: Book's published year
  • $average_rating: Book's rating on Goodreads
  • $my_rating: User's rating of the book (from 1-5)
  • $my_rating_stars: User's rating of the book in emoji star (from ⭐️ to ⭐️⭐️⭐️⭐️⭐️)
No
sort_by_fields ">pubDate" sort the list by fields from the RSS response, preprended by ascending '<' or descending '>' order.

Example:
">user_rating,>average_rating" sorts first by user_rating and within the same user_rating, it'll then sort by average_rating, both in descending order.

Suported fields:

More resources

goodreads-profile-workflow's People

Contributors

alxlenc avatar quentinlintz avatar simon-wicki avatar zwacky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

goodreads-profile-workflow's Issues

Last 5 books doesn't get choosed correct

I configured a "Last 5 Books I've Read" section but the books which appear are not actually the books which are the last 5 books but books which I read lying further in the past. What are the criterias for the algorithm for picking the last 5 books?

Build for v1.2.0 is broken

Please let me first state that I am not a Javascript developer.

Node 12 has a problem with the generated build file dist/index.js. I have pasted here the GitHub Action error ouput:

Run zwacky/goodreads-profile-workflow@main
  with:
    goodreads_user_id: 117462291
    shelf: read
    template: - [$title]($url) by $author
    comment_tag_name: GOODREADS-READ-SHELF
    sort_by_fields: >user_rating,>average_rating
    max_books_count: 10
    readme_file_path: ./README.md
    output_only: false
/home/runner/work/_actions/zwacky/goodreads-profile-workflow/main/dist/index.js:6
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine=""),this.options.supressEmptyNode?(this.buildTextNode=Xo,this.buildObjNode=Jo):(this.buildTextNode=Wr,this.buildObjNode=Yr),this.buildTextValNode=Wr,this.buildObjectNode=Yr}Fe.prototype.parse=function(e){return this.j2x(e,0).val};Fe.prototype.j2x=function(e,r){let t="",n="",s=Object.keys(e),i=s.length;for(let u=0;u<i;u++){let o=s[u];if(typeof e[o]!="undefined")if(e[o]===null)n+=this.indentate(r)+"<"+o+"/"+this.tagEndChar;else if(e[o]instanceof Date)n+=this.buildTextNode(e[o],o,"",r);else if(typeof e[o]!="object"){let c=this.isAttribute(o);c?t+=" "+c+'="'+this.options.attrValueProcessor(""+e[o])+'"':this.isCDATA(o)?e[this.options.textNodeName]?n+=this.replaceCDATAstr(e[this.options.textNodeName],e[o]):n+=this.repl

But, If I run the file localy using node 14 I don't see such error.

TypeError: Cannot read properties of undefined (reading 'channel')

Hi Simon,

Very cool idea with the Goodreads workflow! Thank you for your work there.

I wanted to use it to spice up my own GitHub README but experienced the following error when running the job manually:

TypeError: Cannot read properties of undefined (reading 'channel')

Screenshot from GitHub Actions:
image

This is my workflow in .github/workflows/goodreads-profile-workflow.yml:

name: Latest book list from a goodreads
on:
  schedule:
    - cron: "* * * * 1"
  workflow_dispatch:
jobs:
  update-readme-with-goodreads-books:
    name: Update this repo's README with what you're currently reading
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: zwacky/[email protected]
        with:
          goodreads_user_id: "89343805"
          shelf: "currently-reading"

These are my lines in my README.md file:

<h3>📚 Books I'm currently reading:</h3>
<!-- GOODREADS-LIST:START -->
<!-- GOODREADS-LIST:END -->

My Goodreads ID is correct. Maybe it has something to do with my profile settings on Goodreads?

Thank you in advance for any pointers on how to getting it to run! :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.