huantt / article-listing

Collect your latest articles from sources such as dev.to, and then update the README.md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About

Collect your latest articles from sources such as dev.to, and then update the README.md.

Use GitHub Action to update your README

Step 1: In your repository, create a file named README.md.template.

Step 2: Write anything you want within the README.md.template file.

Step 3: Embed one of the following entities within your README.md.template:

  • Article listing:
{{ template "article-list" .Articles }}
  • Article table:
{{ template "article-table" .Articles }}

If you are familiar with Go templates, you have access to the root variable, which includes the following fields:

  • Articles: An array of Article. You can view the Article struct definition in model/article.go.
  • Time: Updated Time
  • Author: Author of articles

Step 4: Register Github Action

  • Create a file .github/workflows/update-articles.yml in your repository.
name: "Cronjob"
on:
schedule:
- cron: '15 0 * * *'

jobs:
    update-articles:
        permissions: write-all
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3
            - name: Generate README
              uses: huantt/article-listing@v1.1.0
              with:
                username: YOUR_USERNAME_ON_DEV_TO                
                template-file: 'README.md.template'
                out-file: 'README.md'
                limit: 5
            - name: Commit
              run: |
                if git diff --exit-code; then
                    echo "No changes to commit."
                    exit 0
                else
                    git config user.name github-actions
                    git config user.email github-actions@github.com
                    git add .
                    git commit -m "update"
                    git push origin main
                fi

Step 5: Commit your change, then Github actions will run as your specified cron to update Articles into your README.md file

Below is my recent articles JackTT collected from dev.to

Table

thumbnail Graphql Fundamental
GraphQL provides a complete and understandable description of the API, including both "API endpoints"...
03/07/2024
thumbnail Snowflake Schema vs. Star Schema: Pros, Cons, and Use Cases
Star Schema Structure: Central Fact Table: Contains quantitative data for...
11/06/2024
thumbnail Is JWT Safe When Anyone Can Decode Plain Text Claims
If I get a JWT and can decode the payload, how is it secure? Why couldn't I just grab the token out...
06/06/2024
thumbnail Understanding the "SELECT FOR UPDATE" SQL Statement
What is "SELECT FOR UPDATE"? SELECT FOR UPDATE is a clause in SQL that is appended to a...
06/06/2024
thumbnail Managing Concurrent Purchases of Limited Items in a Database
Imagine that we're developing an e-commerce website. In this case, we have a limited number of items...
06/06/2024

List

Updated at: 2024-07-03T06:33:21Z

About

Collect your latest articles from sources such as dev.to, and then update the README.md


Languages

Language:Go 91.5%Language:Smarty 5.6%Language:Dockerfile 3.0%