• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

act – Execute GitHub Actions locally using Docker (Command Examples)

by admin

The “act” command is a tool that allows developers to execute GitHub Actions locally using Docker. GitHub Actions is a powerful feature provided by GitHub for automating various tasks, workflows, and continuous integration/continuous deployment (CI/CD) processes. With “act,” developers can replicate and test their GitHub Actions workflows locally, enabling faster development cycles and more efficient testing.

Here are some key points to understand about the “act” command:

  • Local Execution: Typically, GitHub Actions run in the cloud on GitHub’s infrastructure. However, when using “act,” developers can execute their GitHub Actions workflows locally on their own machines. This allows for faster feedback and debugging during the development process.
  • Docker-Based Execution: “act” leverages Docker containers to execute GitHub Actions workflows locally. Each step of the workflow is executed within a separate Docker container, providing an isolated and consistent environment for testing.
  • Workflow Replication: “act” replicates the workflow defined in a project’s GitHub Actions configuration file (usually named “workflow.yml” or similar). It reads this configuration file, sets up the necessary environment, and executes each step of the workflow locally.
  • Event Simulation: GitHub Actions workflows are triggered by specific events, such as push events, pull requests, or scheduled events. “act” allows developers to simulate these events locally, ensuring that the workflow behaves as expected in different scenarios.
  • Output and Logging: “act” captures and displays the output and logging information generated by each step of the workflow. This helps developers to troubleshoot issues, analyze the workflow’s execution, and understand the behavior of their actions.
  • Workflow Customization: “act” provides options for customizing the execution environment and workflow inputs. Developers can modify environment variables, specify secrets, override input values, or make other adjustments to replicate different scenarios and test their workflows comprehensively.
  • Integration with GitHub Actions Ecosystem: “act” aims to provide a seamless experience for executing GitHub Actions locally. It supports most GitHub Actions features and integrates well with other tools and actions in the GitHub Actions ecosystem.

By using the “act” command, developers can gain the advantages of local execution for their GitHub Actions workflows. They can test and debug workflows locally, iterate quickly, and ensure that their actions perform as expected before pushing changes to the remote repository. This helps streamline the development and testing process, improving overall efficiency and reducing potential issues in the CI/CD pipeline.

act Command Examples

1. List the available actions:

# act -l

2. Run the default event:

# act

3. Run a specific event:

# act event_type

4. Run a specific action:

# act -a action_id

5. Do not actually run the actions (i.e. a dry run):

# act -n

6. Show verbose logs:

# act -v

Filed Under: Linux

Some more articles you might also be interested in …

  1. slocate command in linux
  2. How to connect to an Active Directory Domain using Realmd (Configure CentOS/RHEL 7 as active directory client)
  3. apg – Creates arbitrarily complex random passwords (Command Examples)
  4. Time to live exceeded ping error
  5. acpi: command not found
  6. betterlockscreen Command Examples in Linux
  7. btrfs scrub Command Examples in Linux
  8. bosh Command Examples (Command-line tool to deploy and manage the bosh director)
  9. cryptsetup Command Examples in Linux
  10. CentOS / RHEL : How to block incoming and outgoing ports using iptables

You May Also Like

Primary Sidebar

Recent Posts

  • gixy Command Examples
  • gitsome Command Examples
  • gitmoji Command Examples
  • gitlint Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright