{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {},
  "_ordered_sections": [],
  "item_file": null,
  "item_line": null,
  "item_type": null,
  "aliases": [],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "dev:contributor:using_act",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is a tool offered by Nektos which provides a handy way to run GitHub Actions locally using Docker. "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " provides a quick way to validate your changes on the CI locally, without committing/pushing your changes to the workflows to trigger and validate the same. It leads to fast feedback and its compatibility as a local task runner, to validate all our CI jobs makes it a handy tool."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " can be set up locally with Homebrew, Chocolatey or even a simple BASH script. To set it up using the BASH script, just push the following command on your terminal    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Using Homebrew you can set it up via: "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "brew install act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The next step is to define the custom image that we can use to run our actions locally. "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " provides a micro, medium and larger Docker image for Ubuntu GitHub runner. "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " does not support Windows and macOS images yet."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "While running "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for the first time, we can define the image that we would like to utilize for our local CI runs. The configuration is saved inside the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "~/.actrc"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " file."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In a GitHub repository, while running "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for the first time, it will find the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "./.github/workflows"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and all the workflows present. To checkout the jobs listed as part of the GitHub Actions CI, push the following command    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "act -l",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "It will list all the jobs and you can pick up the particular jobs you wish to run. If you are looking to run a particular job, push in the following command    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "act -j <JOB_NAME>",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To run the job in dry run, push in the following command    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "act -n",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To run the job with verbose logging, push in the following command    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "act -v",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "To reuse the containers in "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to maintain state, push in the following command    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "act -j <JOB_NAME> --bind --reuse",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "It is recommended to comment out GitHub specific events like "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "github.repository"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "github.event.head_commit.message"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". If you are using environment variables, in your action, it is recommended to have a "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "my.secrets"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " file and supply these environment variables to the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "act"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " by pushing the following command    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "act --secret-file my.secrets",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "If the environment variables are supplied via "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": ".env"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " file, use the following command    "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "act --env-file my.env",
          "execution_status": null
        }
      ],
      "title": [
        {
          "__type": "InlineRole",
          "__tag": 4003,
          "value": "act",
          "domain": null,
          "role": null,
          "inventory": null
        },
        {
          "__type": "Text",
          "__tag": 4046,
          "value": " for running GitHub Actions locally"
        }
      ],
      "level": 0,
      "target": "using-act"
    }
  ],
  "local_refs": []
}