Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues 自动生成 Markdown 目录 #74

Open
xiaotiandada opened this issue Apr 7, 2021 · 0 comments
Open

Issues 自动生成 Markdown 目录 #74

xiaotiandada opened this issue Apr 7, 2021 · 0 comments

Comments

@xiaotiandada
Copy link
Owner

xiaotiandada commented Apr 7, 2021

一些相关的工具:

image

  1. 获取 Repo 数据,主要获取 Name、Issues count 信息,然后获取 Issues 信息

    // 分页处理
    let count = (respo as any).open_issues_count
    let per_page = 100 // default 30 max 100
    let len = Math.floor(count / per_page) + 1
  2. 生成 Markdown

  3. Push 内容为 Readme.md

    // push 内容需要 base64
    const contentsBase64 = new Buffer(contents).toString('base64');
  4. 设置 GitHub Action

# This is a basic workflow to help you get started with Actions

name: CI

env:
  TZ: Asia/Shanghai
  OWNER: xiaotiandada
  REPO: blog
  REPO_PATH: README.md

# Controls when the action will run.
on:
  issues:
    types: [opened, edited]
  issue_comment:
    types: [created, edited]

# 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"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [16.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v2
        with:
          node-version: ${{ matrix.node-version }}
      - run: yarn install --immutable
      - run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} node ./lib/index.js

默认时区是 UTC,如果你在国内可以设置环境变量

env:
  TZ: Asia/Shanghai
@xiaotiandada xiaotiandada reopened this May 28, 2021
@xiaotiandada xiaotiandada changed the title 123123 3213123123123123 May 28, 2021
@xiaotiandada xiaotiandada changed the title 3213123123123123 140行写一个自动生成 Issues 为 Markdown 文垱 May 29, 2021
@xiaotiandada xiaotiandada changed the title 140行写一个自动生成 Issues 为 Markdown 文垱 140 行写一个自动生成 Issues 为 Markdown 文垱 May 29, 2021
@xiaotiandada xiaotiandada changed the title 140 行写一个自动生成 Issues 为 Markdown 文垱 Issues 自动生成 Markdown 目录 Jun 30, 2022
@xiaotiandada xiaotiandada added the Top 置顶文章 label Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant