Skip to content

Test workflows with remote Repositories locally

ChristopherHX edited this page Nov 6, 2022 · 1 revision

You usually reference actions and reusable workflows with the remote uses syntax <owner>/<repository>/<path>@<ref>, therefore you may want to test how local changes affects another repository you work on. You need at least runner.server version 3.10.0 or newer to take advantage of this feature.

Test a remote workflow locally

If you store the files of org/name@ref in /path/to/repository you can tests changes to this remote action without commiting it to GitHub.

Runner.Client --local-repository org/name@ref=/path/to/repository

with Workflow

on: push
jobs:
  _:
    uses: org/name/.github/workflows/reusable.yml@ref
    with:
      ref: ${{ github.ref }}

The workflow is read from local path /path/to/repository/.github/workflows/reusable.yml instead of using the GitHub rest api.

Test a remote action locally

If you store the files of org/name@ref in /path/to/repository you can tests changes to this remote action without commiting it to GitHub.

Runner.Client --local-repository org/name@ref=/path/to/repository

with Workflow

on: push
jobs:
  _:
    runs-on: self-hosted
    steps:
    - uses: org/name@ref
      with:
        ref: ${{ github.ref }}

The action is read from a zip or tar archive created from the local path /path/to/repository instead of downloading a zip or tar from GitHub.

Test a remote checkout locally

If you store the files of org/name@ref in /path/to/repository you can tests changes to this remote checkout without commiting it to GitHub.

Runner.Client --local-repository org/name@ref=/path/to/repository

with Workflow

on: push
jobs:
  _:
    runs-on: self-hosted
    steps:
    - uses: actions/checkout@v3
      with:
        repository: org/name
        ref: ref

The content is copied from /path/to/repository instead of using git or the GitHub rest api for downloading the remote repository.