An action for transforming a GitHub Discussion into a markdown output.
Create a workflow (e.g. .github/workflows/discussion-to-markdown.yml
) with the following content:
name: Discussion to Markdown
run-name: Capture ${{ inputs.discussion-url }}
on:
workflow_dispatch:
inputs:
discussion-url:
type: string
description: GitHub discussion URL
required: true
jobs:
test-discussion-to-markdown:
name: Discussion to Markdown
runs-on: ubuntu-latest
steps:
- uses: mamuso/discussion-to-markdown-action@main
with:
discussion-url: ${{ github.event.inputs.discussion-url }}
token: ${{ secrets.TOKEN }}
If you are planning to capture a discussion from the same repository, you can use the default GITHUB_TOKEN
secret (token: ${{ secrets.GITHUB_TOKEN }}
). Otherwise, you will need to create a personal access token and add it to the repository secrets as TOKEN
.
If you are planning to capture discussions from a private repository, you may want to execute this action in a private repo too.
Once you have the workflow in your repository, you can trigger it by going to the Actions tab and:
- Click on the
Discussion to Markdown
workflow on the navigation - Click on the
Run workflow
button - Fill the
discussion-url
input with the URL of the discussion you want to capture
- After submitting the form, you will see the workflow running.
- Once it's done, the markdown content will be available as part of the run summary.
If you need to use the markdown content in a different step, you can use the markdown
output of the action.
This action uses the GitHub graphql API to fetch the discussion content. The API has a limit of 100 comments per page. If your discussion has more than 100 comments, the action will not be able to capture all the content.