Skip to content

Instantly share code, notes, and snippets.

@embano1
Last active May 6, 2021 10:12
Show Gist options
  • Select an option

  • Save embano1/7206aed7fd6aaba67208afc676b5e618 to your computer and use it in GitHub Desktop.

Select an option

Save embano1/7206aed7fd6aaba67208afc676b5e618 to your computer and use it in GitHub Desktop.
Comment on first Github Issue

About

Send greetings to your contributors, e.g. when an issue is created:

Greeting in Issue

Credits: Based on one of Peter Evans' fantastic Github Actions contributions: Create or Update Comment

Greeting Template

Location: .github/comment-template.md

Howdy 🖐   {{ .author }} ! Thank you for your interest in this project. We value your feedback and will respond soon.

Github Action

Location: .github/workflows/issue-comment.yaml

name: Greeting

on:
  issues:
    # only run when issue is created
    types: ["opened"]

jobs:
  greeting:
    name: Create Issue Greeting
    runs-on: ubuntu-latest
    # only send message to first-time contributors
    # https://docs.github.com/en/graphql/reference/enums#commentauthorassociation
    if: github.event.issue.author_association == 'NONE'

    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 1

      - name: Render template
        id: template
        uses: chuhlomin/render-template@v1.2
        with:
          template: .github/comment-template.md
          vars: |
            author: ${{ github.actor }}

      - name: Create comment
        uses: peter-evans/create-or-update-comment@v1
        with:
          issue-number: ${{ github.event.issue.number }}
          body: ${{ steps.template.outputs.result }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment