Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
play

GitHub Action

Issue to Markdown

v0.0.9

Issue to Markdown

play

Issue to Markdown

A GitHub Action to monitor and convert issues into markdown files within your repository

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Issue to Markdown

uses: eunjae-lee/issue-to-markdown@v0.0.9

Learn more about this action in eunjae-lee/issue-to-markdown

Choose a version

typescript-action status

View on Marketplace

issue-to-markdown

GitHub Action to monitor and convert issues into markdown files within your repository.

How do you edit and manage your markdown files within your repository?

  • git pull
  • (merge conflicts)
  • edit files
  • git commit
  • git push
  • 😫

What if you could automatically convert GitHub Issues into markdown files, allowing you to write using just a browser?

Usage

Create a file .github/workflows/issue-to-markdown.yml (or any filename) in your repository.

on:
  issues:
    types:
      - labeled

jobs:
  issue_to_markdown:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
      - uses: eunjae-lee/issue-to-markdown@v0
        with:
          token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
      - uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: 'docs: update contents'

If you add a publish label to any of your issues, this workflow will be activated.

To automatically update the markdown file after making changes to the issue, update the yml file as follows:

on:
  issues:
    types:
      - labeled
      - edited

How It Works

For those unfamiliar with GitHub Actions, here's a breakdown of the process:
  1. In this step, the repository is cloned. A personal access token must be provided as token to allow the workflow to commit and push changes to the remote.
- uses: actions/checkout@v3
  with:
    token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
  1. In this step, the issue is transformed into a markdown file, located in its own folder (default location: content/<slug or issue_number>/index.md). The token is also necessary here.
- uses: eunjae-lee/issue-to-markdown@v0
  with:
    token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
  1. In this step, changes are committed and pushed to the remote. For more information on customizing the commit, refer to this.
- uses: stefanzweifel/git-auto-commit-action@v4
  with:
    commit_message: 'docs: update contents'

Personal Access Token

Visit https://github.com/settings/tokens/new to create a new personal access token. Choose "Tokens (classic)" instead of "Fine-grained tokens".

Click here to see the screenshots.

1. Create a personal access token just like the screenshot at https://github.com/settings/tokens/new

creating personal access token

2. Go to the Settings and add it into the Repository secrets.

setting personal access token

Options

- uses: eunjae-lee/issue-to-markdown@v0
  with:
    # Required
    token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

    # Optional. New files are located at `<project-root>/<dest>/<slug or issue_number>/index.md`. (default: 'content')
    dest: 'content'

    # Optional (default: '.md')
    extension: '.md'

    # Optional. If set to `true`, the `slug` from the frontmatter of the issue body will be used as the folder name instead of `issue_number`. If set to `false`, only `issue_number` is used. (default: true)
    slug_as_folder_name: true

    # Optional. Key for the slug from the frontmatter. This is used only when `slug_as_folder_name` is `true`. (`slug` by default.)
    slug_key: 'slug'

    # Optional. By default, `publish` label is required for the workflow to work.
    label: 'publish'

    # Optional. If not given, only the owner of the repository is authorized to perform this Action. Otherwise, it will fail.
    authors:
      - username1
      - username2

    # Optional. If set to `true`, the title of the issue is injected into the frontmatter of the generated file. (default: true)
    insert_title_to_front_matter: true

    # Optional. Key for the title auto-inserted.
    title_key: 'title'

    # Optional. If set to `true`, timestamp of the issue creation is inserted into the frontmatter of the generated file. (default: false)
    insert_timestamp_to_front_matter: false

    # Optioanl. Key for the timestamp when `insert_timestamp_to_front_matter` is true. (default: 'created_at')
    timestamp_key: 'created_at'

    # Optional. Formatter for the timestamp when `insert_timestamp_to_front_matter` is true. (default: 'ISO')
    # For more information about formatting, read this: https://github.com/iamkun/dayjs/
    timestamp_format: 'ISO'

References