top | item 35514799

Use GitHub Actions to Make Your GitHub Profile Dynamic

195 points| mooreds | 2 years ago |bengreenberg.dev | reply

49 comments

order
[+] nikeee|2 years ago|reply
I've seen something like this being used to show the last X commits in a readme and I hate to be _that_ guy, but do we really need scripts that spin up a VM and install python/ruby/whatever multiple times a day just to potentially update a readme that only a few people will see?

Doing this once a week, like the article mentions, should be good enough for most people. It's not _that_ critical information.

[+] simonw|2 years ago|reply
I do think it's good practice to enable caching, such that your script doesn't hit RubyGems / pip / npm / etc every time it runs.

That way at least the automation activity stays entirely within the GitHub / Azure network.

It looks like you can do that for Ruby by adding this:

https://github.com/actions/cache/blob/master/examples.md#rub...

    - uses: ruby/setup-ruby@v1
      with:
        ruby-version: 3.1
        bundler-cache: true
[+] nine_k|2 years ago|reply
If you want it to be very efficient, pick a language like Rust, Go, Nim, maybe even Crystal or Haskell, which can produce a (mostly) self-contained executable, without installing anything. Write the logic for updating your profile with it, all while honing your efficient coding skills.

The few people who look at your GitHub profile may be some important people, like your every future prospective employer. It may make sense to impress them a little bit.

[+] hk1337|2 years ago|reply
I would even have both repositories on GitHub and see about triggering a workflow in my username repository to run, so it only runs when it needs to.

EDIT

https://blog.marcnuri.com/triggering-github-actions-across-d...

Or you use something like this, build your blog in CI, get the top X posts in its CI workflow, and send it as JSON payload to the GitHub repository with the README you want to upload.

[+] beebmam|2 years ago|reply
I'd guess a single search on Google probably consumes more J than this
[+] simonw|2 years ago|reply
I've been running my profile like this for nearly three years now - it works great! https://simonwillison.net/2020/Jul/10/self-updating-profile-...

https://github.com/simonw is my profile.

https://github.com/simonw/simonw/commits/main shows 1,490 commits updating my profile so far, almost all of them from the GitHub Actions automation.

[+] leipert|2 years ago|reply
Your cron schedule is currently 3 times an hour. So this script ran 78840 times in three years to generate 1490 commits. So less than two percent of scheduled actions triggered a commit.

Wonder if web hooks or event driven execution might be more efficient.

[+] slowhand09|2 years ago|reply
Your updates may be more prolific than many...
[+] OJFord|2 years ago|reply
A much easier way to do this (or at least to get started) is with https://github.com/muesli/markscribe - you just have to write a Go template readme.md.tpl, and run the Action on a cron and it will render it to readme.md.

The article makes it seem like there's something special about .github/scripts - but using that is if anything a bad idea, it's not special, but maybe it will be (at GitHub's discretion) in the future. There's two good points to make: 1) you can have a profile readme; 2) you might like to update it via a cron Action. But don't put your script there and all the waffle about TS and Ruby and whatever is beside the point.

[+] stabbles|2 years ago|reply
The only thing that's missing is a custom repeated background image like it's myspace
[+] bastardoperator|2 years ago|reply
If only we could get a blink tag and some techno music playing full blast.
[+] beardog|2 years ago|reply
You can also make your profile readme executable scripts, since shell scripts can be more or less valid markdown. See mine: https://github.com/egosown
[+] OkayPhysicist|2 years ago|reply
Very cool. Literate programming is always an interesting exercise. In my undergrad I developed a little Julia macro library for turning my code with LaTeX encoded comments into a LaTeX document with code blocks, since the relevant source code needed to be explained as a central part of my thesis.

P.S., nice profile. Just finished reading the Landstreicher translation of The Unique and Its Property last night.

[+] apwheele|2 years ago|reply
Yeah I just have a chart of potholes filled in Raleigh via python, https://github.com/apwheele. (So doesn't update the readme.md itself, just updates the PNG the readme points to.)

Good idea to add in a `timeout-minutes: 15` or something like that for the job (in case scraper code can hang). I agree it is cheeky, but I enjoy watching things I built just work over time.

[+] jamietanna|2 years ago|reply
I've loved doing this myself - https://gitlab.com/jamietanna https://github.com/jamietanna - which pulls information from my website and displays information through the machine parseable Microformats2 standard.

Looking back I did it over a year ago! (https://www.jvt.me/posts/2022/01/12/autogenerated-profile-re...) I keep meaning to rewrite it because it's a set of _very_ rough Go which was some of my first Go I wrote

[+] marginalia_nu|2 years ago|reply
So is this why you've got like an average of 40 commits/day 7 days a week?
[+] wingi|2 years ago|reply
It would be more easy if your blog would offer an rss-feed ... but thank you for the idea.
[+] politelemon|2 years ago|reply
Yeah I was kind of surprised to see the HTML scraping going on; if provide an RSS/ATOM feed and this task is a lot simpler, and doesn't need the overhead of Ruby (or any programming language) either, can easily be done with a bash script.
[+] OkGoDoIt|2 years ago|reply
Woah, I’ve been actively using GitHub for over a decade and I had no idea it had profile pages like this if you make a repo that is the same as your username. Is this a new thing? How did I completely miss the bus on this?
[+] azemetre|2 years ago|reply
Relatively new, the feature rolled around in 2020. It uses yourname/yourname as a special repo.
[+] ethicalsmacker|2 years ago|reply
This kind of activity is exactly what I hate about Github and the new and unimproved "open source community".

No one cares you updated your vimrc file. Nobody wants to see another "awesome list" in a code repository. Nobody cares about that cool project you started over a weekend and haven't touched in three years.

Your commits are not important.

We have become so narcissistic. We are now coding with the kardashians.

[+] qikInNdOutReply|2 years ago|reply
Chat GPT sing me the praises like a medieval bard would sing upon a dragon slaying knight, using this list of commits and contributions.
[+] boredumb|2 years ago|reply
excited to see the next leap forward in github becoming myspace for devs