前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >抓取个人博客文章目录到github主页

抓取个人博客文章目录到github主页

作者头像
姓王者
发布2024-11-12 09:41:02
发布2024-11-12 09:41:02
610
举报
文章被收录于专栏:姓王者的博客
2024-11-11-194849
2024-11-11-194849

如图所见,我在我的github主页上加了我的最近的个人博客的文章

所用项目

gautamkrishnar/blog-post-workflow: Show your latest blog posts from any sources or StackOverflow activity or Youtube Videos on your GitHub profile/project readme automatically using the RSS feed

创建blog-post-workflow.yml

具体的路径应该是.github/workflows/blog-post-workfliw.yml

复制粘贴

代码语言:javascript
复制
# This is a basic workflow to help you get started with Actions

name: Latest blog post workflow

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  #   push:
  #     branches: [ main ]
  #   pull_request:
  #     branches: [ main ]
  schedule: # Run workflow automatically
    - cron: '0 3 * * *' # Runs at 3:00 # 定时任务,每天3:00触发

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  update-readme-with-blog:
    name: Update README with latest blog posts
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - name: Checkout
        uses: actions/checkout@v2

      # Runs a single command using the runners shell
      - name: Update posts
        uses: gautamkrishnar/blog-post-workflow@master
        with:
          feed_list: "https://xingwangzhe.fun/atom.xml" #这里应该替换成自己的rss地址
          max_post_count: 7 # 顾名思义,最大文章数。

添加关键词

在你的主页的readme里面添加

代码语言:javascript
复制
<!-- BLOG-POST-LIST:START -->
<!-- BLOG-POST-LIST:END -->

给予编辑权限

在你主页仓库的settings里,打开Actions设置,选择general,然后选中第一个。并点击save保存设置。

2024-11-11-200456
2024-11-11-200456

触发流程

然后在Actions选择触发Run workflow

2024-11-11-200147
2024-11-11-200147

然后静待结束,就大功告成了!

当然这个还有更多的参数使用,不过我懒得弄:),怎么方便怎么来吧:)

参考

利用GitHub Actions自动获取博客rss文章 | 二丫讲梵 gautamkrishnar/blog-post-workflow: Show your latest blog posts from any sources or StackOverflow activity or Youtube Videos on your GitHub profile/project readme automatically using the RSS feed

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2024-11-11,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 创建blog-post-workflow.yml
  • 添加关键词
  • 给予编辑权限
  • 触发流程
  • 参考
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档