Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
February 13, 2021 09:32 pm GMT

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

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

"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.


Original Link: https://dev.to/github/run-your-github-actions-locally-5gfl

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To