Giter Club home page Giter Club logo

add-pr-comment's Introduction

add-pr-comment

A GitHub Action which adds a comment to a pull request's issue.

Features

  • Fast, runs in the GitHub Actions node.js runtime; no Docker pull needed.
  • Modify issues for PRs merged to master.
  • Multiple posts of the same comment optionally allowable.
  • Supports emoji ๐Ÿ˜‚๐Ÿ˜‚๐Ÿ˜‚!
  • Supports a proxy for fork-based PRs. See below.

Usage

on:
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: mshick/add-pr-comment@v1
        with:
          message: |
            **Hello**
            ๐ŸŒ
            !
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          repo-token-user-login: 'github-actions[bot]' # The user.login for temporary GitHub tokens
          allow-repeats: false # This is the default

You can even use it on PR Issues that are related to PRs that were merged into master, for example:

on:
  push:
    branches:
      - master

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: mshick/add-pr-comment@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          message: |
            **Hello MASTER**
          allow-repeats: true

Configuration options

Variable or Argument Location Description Required Default
message with The message you'd like displayed, supports Markdown and all valid Unicode characters yes
repo-token with A valid GitHub token, either the temporary token GitHub provides or a personal access token maybe
repo-token-user-login with Define this to save on comment processing time when checking for repeats. GitHub's default token uses github-actions[bot] no
allow-repeats with A boolean flag to allow identical messages to be posted each time this action is run no false
proxy-url with A string for your proxy service URL if you'd like this to work with fork-based PRs no
GITHUB_TOKEN env A valid GitHub token, can alternatively be defined in the env maybe

Proxy for Fork-based PRs

GitHub limits GITHUB_TOKEN and other API access token permissions when creating a PR from a fork. This precludes adding comments when your PRs are coming from forks, which is the norm for open source projects. To work around this situation I've created a simple companion app you can deploy to Cloud Run or another host to proxy the create comment requests with a personal access token you provide.

See this issue: https://github.community/t/github-actions-are-severely-limited-on-prs/18179/4 for more details.

Check out the proxy service here: https://github.com/mshick/add-pr-comment-proxy

Example

on:
  pull_request:

jobs:
  pr:
    runs-on: ubuntu-latest
    steps:
      - uses: mshick/add-pr-comment@v1
        with:
          message: |
            **Howdie!**
          proxy-url: https://add-pr-comment-proxy-94idvmwyie-uc.a.run.app
          repo-token: ${{ secrets.GITHUB_TOKEN }}

add-pr-comment's People

Contributors

mshick avatar dependabot[bot] avatar alekseyleshko avatar juliangro avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.