DEV Community

0 seconds of 36 secondsVolume 90%
Press shift question mark to access a list of keyboard shortcuts
00:00
00:00
00:36
 
Brian Douglas for GitHub

Posted on β€’ Edited on

14 4

Run your GitHub Actions like a makefile

When developing GitHub Action workflows, you might find yourself pushing arbitrary commits to trigger the logs.

Don't do that!

Instead, use the tools available to you to debug locally, like act.

GitHub logo nektos / act

Run your GitHub Actions locally πŸš€

act-logo

Overview push Join the chat at https://gitter.im/nektos/act Go Report Card awesome-runners

"Think globally, act locally"

Run your GitHub Actions locally! Why would you want to do this? Two reasons:

  • Fast Feedback - Rather than having to commit/push every time you want to test out the changes you are making to your .github/workflows/ files (or for any changes to embedded GitHub actions), you can use act to run the actions locally. The environment variables and filesystem are all configured to match what GitHub provides.
  • Local Task Runner - I love make. However, I also hate repeating myself. With act, you can use the GitHub Actions defined in your .github/workflows/ to replace your Makefile!

How Does It Work?

When you run act it reads in your GitHub Actions from .github/workflows/ and determines the set of actions that need to be run. It uses the Docker API to either pull or build the necessary images, as defined in your workflow…

When you run act it reads in your GitHub Actions from .github/workflows/ and determines the set of actions that need to be run. It uses the Docker API to either pull or build the necessary images, as defined in your workflow files and finally determine the execution path based on the defined dependencies. Once it has the execution path, it then uses the Docker API to run containers for each action based on the images prepared previously. The environment variables and filesystem are all configured to match what GitHub provides.

Check out the creator's GitHub Actions Hero story.

This is part of my 28 days of Actions series. To get notified of more GitHub Action tips, follow the GitHub organization right here on Dev.

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (3)

Collapse
 
skullface profile image
skullface β€’

omg this is timely and helpful as hell, I just did that and rebased to remove my random commits EARLIER TODAY. thanks @bdougie!!!

Collapse
 
bdougieyo profile image
Brian Douglas β€’

I am glad I can be helpful!

Collapse
 
kreutzenia profile image
kreutzenia β€’

Super

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay