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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file gh-pr-commenter-1.0.0.tar.gz.

File metadata

  • Download URL: gh-pr-commenter-1.0.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for gh-pr-commenter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 003ab4986f1ce66e7e326ddab2a9414e0c9bf7cc549cd196ce0bb31a84f06d31
MD5 5a1223cad833c7542c99eef0a8ecc20f
BLAKE2b-256 0e79f5b20227cd771d54b72acf3b9b80f47cb5419fe60187bf090d2f43bf9eaf

See more details on using hashes here.

File details

Details for the file gh_pr_commenter-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: gh_pr_commenter-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1

File hashes

Hashes for gh_pr_commenter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1ebe911a31381ca321b5a7457cbcc63b0e4f296f096fa64b513e5bcd6c86a4e
MD5 dff56d7c1cf22892623b607e8bac58e9
BLAKE2b-256 9c0c04f451e94f838f4a33b583dff78754fd82c256eaa8cc98e6b72d5ca7f62e

See more details on using hashes here.

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