Skip to main content
In this guide, we’ll dive into the key directories of a self-hosted GitHub Actions runner. You’ll learn how to inspect diagnostics in _diag/ and explore workflow workspaces in _work/. We’ll keep the runner process running in one shell while using a second terminal to inspect its file structure in real time.

Table of Contents

  1. Directory Layout
  2. Inspecting Diagnostic Logs (_diag/)
  3. Exploring the Workflow Workspace (_work/)
  4. Real-Time Diagnostics
  5. Cleanup
  6. Summary
  7. Links and References

1. Directory Layout

Start the runner in one terminal:
Open a second terminal to inspect the directory structure:
  • _diag/: Contains both runner and worker logs.
  • _work/: Hosts the workspace where jobs execute.

2. Inspecting Diagnostic Logs (_diag)

Use tree to view the log layout:
Display the contents of a runner log:
If you encounter connectivity or authentication issues, always start with the latest entries in _diag/pages/Runner_*.log and _diag/pages/Worker_*.log.

3. Exploring the Workflow Workspace (_work)

3.1 Before Any Job Runs

By default, the workspace is mostly empty:

3.2 Preparing a Long-Running Workflow

To observe changes in _work/ during execution, use a simple workflow that sleeps:
Commit and trigger via Run workflow in the GitHub UI.
Using sleep 1500s keeps the job alive long enough to explore file changes. Remember to cancel or stop the runner when done.

3.3 Monitoring Job Start

In the runner terminal you’ll see:

3.4 After Job Initialization

Re-execute the tree command:

3.4.1 PipelineFolder.json

Metadata about your repo and workspace:

3.4.2 Generated Shell Script

Your run: commands are translated into a shell script:

3.4.3 Workflow Event Payload

The full event that triggered the job lives in event.json:

3.4.4 Runner File Commands

Commands such as ::set-env and ::add-path are materialized into files under runner_file_commands. The runner engine reads these to adjust environment variables, outputs, and step summaries.

4. Real-Time Diagnostics

While the job is running, new logs continuously populate _diag:
Live snippet from a worker log:

5. Cleanup

When you’ve finished inspecting logs and workspace files, stop the runner:
This terminates the current job and shuts down the service.

6. Summary

  • _diag/: Central location for runner and worker diagnostics.
  • _work/: Contains your repo checkout, generated scripts, event payloads, and runner file commands.
  • Monitoring these folders in real time is essential for debugging connectivity, authentication, and workflow execution on self-hosted runners.

Dry-run these steps to gain confidence in troubleshooting and customizing your self-hosted GitHub Actions runners.

Watch Video