Skip to main content

Simple Script to post a github comment to a given PR based on a jinja2 template

Project description

github-pr-log-commenter

Simple script that posts a comment to a Github PR based on a jinja2 template. This template has two simple variables:

{{pullRequestAuthor}}: Will be replaced by the author of the pull request

{{contents}}: Will be replaced by the contents of a given file (e.g. a log)

You need to define the GH_TOKEN environment variable with at least the repo scope.

usage:

usage: github-pr-commenter.py [-h] repo prnumber template logfile

positional arguments:
  repo        Organization and repository (e.g. xbmc/repo-plugins)
  prnumber    PR number (e.g. 5)
  template    Jinja 2 template file to generate a comment from
  logfile     Log file to parse (e.g. mylog.log)

optional arguments:
  -h, --help  show this help message and exit

Example template

## Something was successfull
Hey @{{pullRequestAuthor}},
we found no major flaws with your code. Still you might want to look at this logfile, as we usually suggest some optional improvements.


<details>
  <summary>
    <strong>
     Expand log file
    </strong>
  </summary>

` ` `
{{contents}}
` ` `

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gh-pr-commenter-1.0.0.tar.gz (2.8 kB view hashes)

Uploaded Source

Built Distribution

gh_pr_commenter-1.0.0-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page