DEV Community

Cover image for GitHub Actions: A Maintainer's Best Friend
Nick Taylor Subscriber for OpenSauced

Posted on • Edited on • Originally published at opensauced.pizza

GitHub Actions: A Maintainer's Best Friend

As developers, it’s in our best interest to automate things. The less we have to do in a manual way, the better. As soon as manual intervention is required, there is potential for failure or a mishap. Aside from that, it’s your time as a maintainer that could be spent elsewhere.

If you host your code on GitHub, besides scripts to automate certain actions, you can also leverage the huge ecosystem of GitHub
Actions
.

Practical Examples

Let’s look at some practical examples of GitHub actions helping maintainers.

peter-evans/create-or-update-comment

If someone opens an issue on your repository, you could respond with a personal message saying thank you, but those keystrokes are probably better suited for other things. Automate a message reply instead, thanking the community member for creating the issue and mentioning you will look into it. An automated message to the issue opener is friendly, even if it’s automated.

A great GitHub action for this is Peter Evans’ Create or Update Comment action.

It’s used in the app repository for OpenSauced. Here’s how we have it configured.

When a new issue is opened, an issue responds with the following:

Automated comment when an issue is created in the OpenSauced App repository that says

bdougie/take-action

My coworker bdougie (@bdougieyo) created the take Github action. It allows external contributors to self-assign issues by typing .take into a comment of an issue. This removes the burden of a bit of back and forth between contributors and maintainers.

OpenSauced contributor itskish0re self assigning an issue by using the .take command

Of course, we don’t want external contributors self-assigning any issue they want. The take action also has the concept of blocking labels. For example, if an issue has a 👀 needs triage label, we can add this label to a list of blocking labels.

Someone trying to self-assign an issue when there are blocking labels on the issue

balazsorban44/nissuer

Another action that came onto my radar a couple of days ago was thanks to styfle. Although I haven’t used it yet, nissuer looks like a great utility belt GitHub action for maintainers. The Next.js repository uses it, so I'm sure it brings lots of value to a maintainer.

I love this note they added in the README.

NOTE: Developers are coming to your project with all sorts of backgrounds/skill levels or understanding of the open-source world. Show empathy while using this action. 💚 We recommend adding comments that not only dismiss unhelpful issues/comments, but educate the user on how to be more helpful in the future.

Bespoke Actions

Don’t see a GitHub action for what you need? Create your own. You can even build your own by composing it from existing GitHub actions. Here's an example of a bespoke workflow I use for pulling in my latest video content from YouTube to my blog.

I'm using some GitHub Actions, a custom script that leverages the GitHub CLI and magic.

name: Get latest videos
on:
  schedule:
    # Everyday at midnight UTC
    - cron: '0 0 * * *'
  workflow_dispatch:

jobs:
  update_profile_data:
    name: Get latest videos
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v3
        with:
          node-version: 18
      - name: Get latest videos
        run: |
          npm install
          node bin/udpdateStreamingPage.js
      - name: Setup git config
        run: |
          git config user.name 'token-generator-app[bot]'
          git config user.email '82042599+token-generator-app[bot]@users.noreply.github.com'
      - name: PR for Videos
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |
          ./bin/pr-videos.sh
Enter fullscreen mode Exit fullscreen mode

You can see the results on the streaming page of my site.

The post is a bit out of date, but I discuss more in depth the automations for my website in

Conclusion

These are just examples of tasks you can automate, and if you’re using GitHub, there is a huge ecosystem of GitHub actions to help with your automation goals.

What are some GitHub actions that you’ve leveraged in your projects? Share them in the comments.

Stay saucy peeps!

If you would like to know more about my work in open source, follow me on OpenSauced.

Top comments (6)

Collapse
 
thomasbnt profile image
Thomas Bnt

GA is really useful, thanks for your post ! 👻

Collapse
 
nickytonline profile image
Nick Taylor

Captain America saluting

Collapse
 
der_gopher profile image
Alex Pliutau

Great write-up! We also have a bunch of articles on Github Actions in our Newsletter, check it out - packagemain.tech/p/github-actions-...

Collapse
 
nickytonline profile image
Nick Taylor

Thanks, Alex, and thanks for sharing your newsletter!

Collapse
 
raskyld profile image
Enzo Nocera

I didn't except such useful posts when I first followed OpenSauced, but your contents are truly awesome! 🙏

Collapse
 
nickytonline profile image
Nick Taylor

Jake Peralta from Brooklyn Nine Nine saying Hella Fresh!