Testing Repos

Testing repos are links to public repos (or any repo that is accessible from your test execution environment). These are repos that could support your action, but may or may not have the action installed.

When ActionBlocks executes the tests, it will clone these repos and check out the ref (tag or sha) that you specified. It’s a good idea to specify a stable ref and not use “master” to ensure that tests are reliable and not flaky. After checking out this ref, ActionBlocks will overlay a customized .github/main.workflow file and invoke the action locally.

Per Repo Environment

Some actions may requuire specific environment variables to help identify how to run in a specific repo. ActionBlocks supports setting per-repo environment variables that will be written into the main.workflow overlay file before executing. This, combined with using a stable git ref, is a great way to create an extremely reliable test suite for any GitHub Action you are distributing.

Private Repos

ActionBlocks can support cloning and testing in private repos. The testing application does not have access to any local ssh keys to clone a repo. When attempting to make a local clone of a repo to execute a test, ActionBlocks will:

  1. Attempt to clone the repo without any authentication.
  2. Attempt to clone using http with a username/password if there is a GITHUB_USERNAME and GITHUB_PASSWORD environment variable set.
  3. Attempt to clone using an access token if there is a GITHUB_TOKEN environment variable set.

To enable these authentication methods, simply add new environment variables to the docker run command.

For example:

docker pull actionblocks/testing-block && \
docker run \
  -v /var/run/docker.sock:/var/run/docker.sock \
  -v `pwd`:/action \
  -v /tmp:/tmp \
  -e ACTIONBLOCKS_MOUNTED_WORKSPACE=/tmp \
  -e GITHUB_TOKEN=<1234567890abcdef> \    <-- adding a github personal access token here
  actionblocks/testing-block \
  testing --plan-token <some-plan-token>