/post-comment-to-markdown-pr

Create pull requests for blog comments (markdown) posted via a form (v3 function)

Primary LanguageC#MIT LicenseMIT

Post Comment to Markdown Pull Request Azure Function

An Azure Function App that receives HTTP form posts containing a comment for a blog and turns them into pull request against your GitHub repository.

The app includes two functions:

  • PostComment - receives form POST submission and creates a PR to add the comment to your Jekyll site
  • Preload - consider calling this from inside your textarea's change event notificiation to warm up the function

Setup

To set this up, you'll need to have an Azure Portal account.

  1. Fork this repository
  2. Create a v3 Azure Function
  3. Set up your function to deploy from your fork
  4. Set up the following App Settings for your Azure Function
Setting Value
PostCommentSettings__PullRequestRepository owner/name of the repository that houses your Jekyll site for pull requests to be created against. For example, damieng/damieng.com will post to https://github.com/damieng/damieng.com
PostCommentSettings__GitHubToken A GitHub personal access token with access to edit your target repository.
PostCommentSettings__CommentWebsiteUrl The URL to the website that hosts the comments. This is used to make sure the correct site is posting comments to the receiver.
PostCommentSettings__CommentFallbackCommitEmail The email address to use for GitHub commits and PR's if the form does not supply one.