# Github Can Be Played Like This?

> Make your Github profile page a blog homepage, and automatically update information display every day.

- Published: 2020-07-17
- Author: Tw93
- HTML: https://tw93.fun/en/2020-07-17/markdown.html
- Chinese original: https://tw93.fun/2020-07-17/markdown.md
- All posts: https://tw93.fun/en/posts.md

---

> The [personal answer](https://www.zhihu.com/question/23498424/answer/1348093118) to "What is the most interesting project you have seen on GitHub?" on Zhihu has some article feeling, so I put it directly into the column.

## So how can it be played?

The answer is **Make your Github profile page a blog homepage, and automatically update information display every day.**

A few days ago, github released a new easter egg, which will automatically display the README of the repository with the same username under your repository to the top of your personal page, which looks like this:

### [github.com/tw93](https://github.com/tw93) Welcome to Follow

<img src="https://gw.alipayobjects.com/zos/k/as/WL2zER.jpg" alt="tPPfRZ" width="800" />

I spent two days of free time on the weekend tossing it. Through Github Actions, it automatically runs my open source warehouse, blog, WakaTime and Douban updates every day, and then writes them into README. Programmability has been greatly improved, very trendy!

## How is it implemented? Sync knowledge points one by one to everyone

### Prerequisite Knowledge

- How to display Markdown content on your Github profile page, see [how-to-create-a-github-profile-readme](https://www.aboutmonica.com/blog/how-to-create-a-github-profile-readme)
- How to use Github Actions to automate content processing, see [https://github.com/features/actions](https://github.com/features/actions)

### Clever way to automatically obtain information

**The above implementation details can be seen in the [github.com/tw93/tw93](https://github.com/tw93/tw93) repository**, there are several good implementations:

#### 1. Use the Api provided by Github

<img src="https://gw.alipayobjects.com/zos/k/2w/W3OtdM.jpg" width="600" />

For example, Product Releases in the picture is implemented by using [GraphqlClient](https://pypi.org/project/graphqlclient/) in Python to obtain [Github Graphql Api](https://developer.github.com/v4/). First, get all the repository field information under the current user, and then assemble it into the format you need by string concatenation.

### 2. Using the RSS address of the website is very convenient

<img src="https://cdn.tw93.fun/blog/upic/DqjHVz.jpg" width="600" />

For example, for the Recent Blog and Funny Soul sections, blog information can be quickly obtained using [feed.xml](https://tw93.github.io/feed.xml).

Douban's dynamic information was originally intended to be crawled using python, but the implementation would be clumsy, and the login status needs to be maintained every once in a while. Coincidentally, I saw the following [feed rss](https://www.douban.com/feed/people/username/interests) when processing personal page information, and I did what would have taken a day in half an hour;

Rss information processing can obtain the corresponding Rss content array through [feedparser](https://pythonhosted.org/feedparser/), and then concatenate it.

### 3. Use the API provided by automated tools

<img src="https://cdn.tw93.fun/blog/upic/lfrh69.jpg" width="600" />

For example, the [Weekly Development Breakdown](https://gist.github.com/tw93/7854aac61f991ef4e7ae7b8440e4fdc6) section mentioned above, I highly recommend everyone to use the tool [wakatime](http://link.zhihu.com/?target=https%253A//wakatime.com/) to count your code time. Specific usage can be Googled, not detailed here;

How to draw the figure below, you can refer to the code in [tw93/waka-box](https://github.com/tw93/waka-box), use [wakatime-client](https://github.com/jaebradley/wakatime-client) to get information, and then also perform string concatenation processing. Since it was modified from a previous fork, a [gist](https://gist.github.com/tw93/7854aac61f991ef4e7ae7b8440e4fdc6) will be generated eventually.

Finally use [httpx](https://www.python-httpx.org/) to get the corresponding raw text content, and then insert it through Markdown code syntax.

## More Ideas

Combining Github Profile Readme and Actions capabilities can do more interesting things. For example, you can automatically generate articles that need to be read every day to the homepage, so you don't need to look for them. Refer to [github.com/simonw](https://github.com/simonw). Some processing borrowed simonw's ideas when tossing on the weekend.

There is also a "funny way to play", you can record an mp4, and then convert it to gif and put it on the homepage, which will be more interesting, such as [praveenscience](https://github.com/praveenscience/).

<img src="https://gw.alipayobjects.com/zos/k/it/iShot2020-07-1918.36.05.gif" width="600" />

There is also a "more 6666", directly moving the game to the homepage, moving chess pieces by sending issues, and then updating dynamically. Many people are playing, and there are rankings, very trendy, such as [timburgan](https://github.com/timburgan).

<img src='https://gw.alipayobjects.com/zos/k/sc/v2-1d3ac494f0a53a183e7da8f5566f9acd_hd.gif' alt='v2-1d3ac494f0a53a183e7da8f5566f9acd_hd' width="600"/>

Found an awesome repository specifically for github profile readme, submitted a PR, which collects a lot of cases and usages, see [abhisheknaiidu/awesome-github-profile-readme](https://github.com/abhisheknaiidu/awesome-github-profile-readme).

## Ending

Suddenly feel that foreign programmers are quite good at playing, very trendy, worth our learning and communication, less meaningless overtime, write more interesting code.
