GitHub Action Hero: Stefan Zweifel and “git-auto-commit”

GitHub Actions gives you the power to automate your workflow. Connect with the tools you know and love. Have more freedom to innovate and be creative. Deploy to any cloud,…

|
| 4 minutes

GitHub Actions gives you the power to automate your workflow. Connect with the tools you know and love. Have more freedom to innovate and be creative. Deploy to any cloud, build containers, automate messages, and lots more. It’s time to take control.

There’s lots of amazing Actions built every day. We spoke to some of the coolest developers building the latest Actions. We recently shared Eddie’s story. This week we have Stefan Zweifel. He’s the man behind an awesome Action to detect file changes during a workflow run. Here we share some of Stefan’s story and some great insights into his GitHub Action.

Why GitHub Actions?

Stefan is a Full Stack Developer. He works in PHP, Laravel, and Vue JS. He’s had ideas for CI/CD tools for a number of years. Three years ago however, these services weren’t widely available. They also were not as easy to understand:

The available services back then weren’t as flexible and easy to understand as GitHub Actions is today.

When GitHub Actions was first announced, Stefan immediately started working on his Action. He thought he could build something awesome. He did, and it worked! Stefan even wrote a blog post on GitHub Actions and how PHP developers could use his Action. So let’s take a look at Stefan’s Action.

Automatically detect file changes during a Workflow run

Through his work, Stefan loves figuring out how to automate some of this day to day work. This is probably one of the reasons why Stefan built an Action to automatically detect file changes during any Workflow run. It’s called git-auto-commit. Once changes are detected, those are committed and pushed back to the GitHub repo. Some of the best products and services are built because that person had a need. Stefan built git-auto-commit because he wanted to personally use it:

I personally use [git-auto-commit] to let linters automatically fix my PHP and JavaScript code in pull requests. In another project I use the Action in conjunction with the schedule feature of Actions: At the start of each month a Workflow updates a sqlite-database with a new dataset from an API. The Workflows generates a static site based on the sqlite-database and the git-auto-commit Action pushes the updated sqlite-database back to the repository.

Lots of other developers have been using the Action too. In some of his chats with the community, Stefan has discovered people are using it for multiple reasons. Developers are using it to:

Build JavaScript and CSS assets on GitHub Actions and push the built files back to the repository – Copy the content of other GitHub repositories into the main repository and commit the changes – Build a static documentation website and push the changes to the “gh-pages” -branch – Update the repository and create a new tag and release git-auto-commit is such a low level Action, the sky is really the limit here.

The sky really is the limit. We highly encourage you to go check out Stefan’s Action.

Lessons, Challenges, and Tips

One of the things developers love about GitHub Actions is how easy it is to use. Many developers have shared this same sentiment over the course of our Action Heroes blog series. Stefan is no different. He says it’s so easy to get started in just a few minutes:

My favorite feature of GitHub Actions is the ease of use to get started. You can use an existing Docker Actions template and start working on your next Action within a couple of minutes

But as we’ve said before, all good things aren’t without their challenges. For Stefan, these challenges came initially:

In the beginning, it was the authentication layer between the Action runner and GitHub. There are many closed issues on the repository were people struggled with errors where the commit couldn’t be pushed to GitHub. Thankfully, v2 of the “checkout”-Action fixed all of that… It’s challenging but I enjoy the learning experience.

Now Stefan’s biggest challenge is adding a test suite. But he’s right on the learning front. Nothing is rewarding if it isn’t a little challenging. In fact, Stefan’s top tip for developers is not to be afraid:

The most important lesson I’ve learned so far with Actions – and open source work in general – is to just release your code into the wild and see what happens. If others can benefit from it: great, if they contribute with questions or updates to the docs: even better. If nobody is interested: Well, at least you’ve made your own life a bit easier.

So what are you waiting for? Get started today.

Get involved with GitHub Actions

Did Stefan’s story inspire you? Are you keen to dive in? As he said, it’s easy to get started and super fun. Head on over to our Learning Lab course to learn the basics. You can also find git-auto-commit, and hundreds of other GitHub Actions on the GitHub Marketplace.

If you liked Stefan’s story, make sure you read up on all our awesome Action Heroes like Hookkshot, Daniel, and more. Don’t forget to check out how GitHub Actions are being used in the COVID response with the Karuna Project.

Finally, if you really want to get involved, join us for the GitHub Actions over on Dev.to.

Written by

Michelle Mannering

Michelle Mannering

@MishManners

I'm a Content Producer working in tech & innovation. Known as the “Hackathon Queen” 👑 I'm on the GitHub DevRel team and love sharing stories from our amazing community of developers.

Related posts