Automate Your Replies to GitHub Issues

Join me as I use GitHub Actions to automate an initial reply to any GitHub issues raised against my repositories.

Automate Your Replies to GitHub Issues
Automate Your Replies to GitHub Issues

Lately I've been spending more time within GitHub. I'm trying to be more conscious of not dumping things into a repository and then moving on.  

I'm trying to be a better citizen to my fellow techies and observers. Trying to ensure the right information is there for them to be successful if they pick up something I've put there.

As such I am exploring features within GitHub and I've set up an auto reply to any GitHub issues that are raised within one of my repositories.

What are GitHub actions and how do they work?

GitHub Actions are a way of executing code as a result of an event happening.

GitHub actions is mostly commonly used to automate the build, test and deployment of your software application.  

However, we are seeing more and more uses of the GitHub Actions feature outside of that original scope.  One of which is replying to any issues raised against your repository.

What are GitHub Issues?

GitHub Issues are a way of tracking ideas, feedback, tasks, bugs or questions against the work you have within a repository.  Anyone with read access to your repository can create an issue.

Automate replies to GitHub Issues

I've created a GitHub Actions workflow that will reply to any GitHub issues with an automated reply and will also create a reply to any pull request (PR) made.  Below is the YAML file.

on:
  fork:
  push:
    branches: [main]
  issues:
    types: [opened]
  pull_request_target:
    types: [opened]


jobs:
  welcome:
    runs-on: ubuntu-latest
    steps:
      - uses: EddieHubCommunity/gh-action-community/src/welcome@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          issue-message: "It's great to have your input on this project."
          pr-message: "Thank you for contributing to this project, your support is much appreciated."
          footer: "Stay awesome!"

Let's walk through what it all means. This first section tells the GitHub Action when to trigger.  So it will trigger when an issue is opened or when a pull request is opened.

on:
  fork:
  push:
    branches: [main]
  issues:
    types: [opened]
  pull_request_target:
    types: [opened]

The second section tells the action what to do when it is trigger.  

jobs:
  welcome:
    runs-on: ubuntu-latest
    steps:
      - uses: EddieHubCommunity/gh-action-community/src/welcome@main
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          issue-message: "It's great to have your input on this project."
          pr-message: "Thank you for contributing to this project, your support is much appreciated."
          footer: "Stay awesome!"
  • This Action will run on a Ubuntu runner.
  • It will respond to issues with "It's great to have your input on this project".
  • It will respond to pull requests with the message "Thank you for contributing to this project, your support is much appreciated".
  • It will add "Stay awesome!" to the end of the message as well.

The workflow takes advantage of a community action that has been created by Eddie Jaoude: https://github.com/EddieHubCommunity/gh-action-community. I'm not calling this action from the GitHub Actions Marketplace, instead I am calling it straight from the GitHub repo that it is stored in.

To see the Action in flow on one of my repositories please head over here.

For more tips and tricks on how to get the most out of GitHub be sure to check out  my video: