Skip to content

Commit 69b7b73

Browse files
committed
Added readme
1 parent ef23628 commit 69b7b73

File tree

4 files changed

+109
-0
lines changed

4 files changed

+109
-0
lines changed

README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
<h1 align="center">Github Readme Learn Section - <i>Github Action</i></h1>
2+
<div align="center"><b>Automatically update your github README learn section with data fetched from a remote notion database.</b></div>
3+
</br>
4+
<p align="center">
5+
<a href="https://app.codecov.io/gh/Devorein/github-action-learn-section-notion/branch/master"><img src="https://img.shields.io/codecov/c/github/devorein/github-action-learn-section-notion?color=blue"/></a>
6+
<a href="https://github.com/Devorein/github-action-learn-section-notion/actions/workflows/build.yml"><img src="https://github.com/devorein/github-action-learn-section-notion/actions/workflows/build.yml/badge.svg"/></a>
7+
<img src="https://img.shields.io/github/repo-size/devorein/github-action-learn-section-notion?style=flat-square&color=orange"/>
8+
<img src="https://img.shields.io/github/contributors/devorein/github-action-learn-section-notion?label=contributors&color=red"/>
9+
</p>
10+
11+
## Configuration
12+
13+
| Option | Description | Default |
14+
| :-----------: | :-----------------------------------------------: | :-----: |
15+
| `database_id` | Set this to the id of your remote notion database | - |
16+
| `token_v2` | Set this to your notion `token_v2` | - |
17+
18+
## Usage
19+
20+
### In Repository File
21+
22+
#### 1. Add the following content to your `README.md`
23+
24+
```markdown
25+
## What I know so far
26+
27+
<!--START_SECTION:learn-->
28+
<!--END_SECTION:learn-->
29+
```
30+
31+
#### 2. Configure the workflow
32+
33+
```yaml
34+
name: 'Github Readme Updater'
35+
on:
36+
workflow_dispatch:
37+
schedule:
38+
- cron: '0 0 * * *' # Runs Every Day
39+
jobs:
40+
update_learn:
41+
name: 'Update learn section'
42+
runs-on: ubuntu-latest
43+
steps:
44+
- name: 'Fetching Repository Contents'
45+
uses: actions/checkout@main
46+
- name: 'Learn Section Updater'
47+
uses: 'devorein/github-action-learn-section-notion@master'
48+
with:
49+
database_id: '6626c1ebc5a44db78e3f2fe285171ab7'
50+
token_v2: ${{ secrets.NOTION_TOKEN_V2 }}
51+
```
52+
53+
### In your notion account
54+
55+
#### 1. Create a full page database
56+
57+
![Notion Full Page Database](./media/notion_full_page_db.png)
58+
59+
**NOTE**: Your database must maintain the following structure/schema
60+
61+
| Name | Type | Required | Default | Description | Value | Example |
62+
| :------: | :----: | :------: | :-----: | :-------------------------------------: | :-----------------------------------------------------------------------------: | :---------------: |
63+
| Name | title | true | - | The name of the item you've learnt | Must be a valid icon from `https://simple-icons.github.io/simple-icons-website` | React, Typescript |
64+
| Category | select | true | - | The category under which the item falls | Any string | Language, Library |
65+
| Color | text | false | black | Background Color of the badge | Any keyword color or hex value without alpha and # | red,00ff00 |
66+
67+
#### 2. Get the id of the database
68+
69+
![Notion Full Page Database Id](./media/notion_full_page_db_id.png)
70+
71+
#### 3. Add it in workflow file
72+
73+
```yaml
74+
with:
75+
database_id: '6626c1ebc5a44db78e3f2fe285171ab7'
76+
```
77+
78+
#### 4. Get your notion `token_v2`
79+
80+
**NOTE**: By no means should you share or expose your notion `token_v2`. If you feel like you've done so accidentally, immediately log out from that account in all of your devices.
81+
82+
Follow the steps below to obtain your `token_v2`:
83+
84+
1. Open up the devtools of your preferred browser.
85+
2. Go to the Application > Cookies section.
86+
3. There you'll find a `token_v2` cookie.
87+
88+
**NOTE**: Its highly recommended to store your `token_v2` as a github secret rather than pasting it in your workflow file.
89+
90+
#### 5. Create a github secret to store `token_v2`
91+
92+
1. navigate to the url `https://github.com/<USERNAME>/<REPO-NAME>/settings/secrets/actions`
93+
2. Click on `New repository secret`
94+
3. You can name your secret as anything you want
95+
4. Paste the `token_v2` value in the `Value` textarea
96+
5. Use the secret in your workflow file
97+
98+
```yaml
99+
with:
100+
token_v2: ${{ secrets.NOTION_TOKEN_V2 }} # The secret was named NOTION_TOKEN_V2
101+
```
102+
103+
### Outcome
104+
105+
If you follow all the steps properly your readme should look something like this.
106+
107+
![Github Readme Learn Section](./media/github_readme_learn_section.png)
108+
109+
Feel free to submit a pull request or open a new issue, contributions are more than welcome !!!
23 KB
Loading

media/notion_full_page_db.png

48.8 KB
Loading

media/notion_full_page_db_id.png

9.62 KB
Loading

0 commit comments

Comments
 (0)