Prompt Buddy logoPrompt Buddy

github · GitHub Actions Docs

Actions Running scripts before or after a job - GitHub Docs

Instructions for executing custom scripts on self-hosted runners at specific lifecycle stages of a job to perform setup or cleanup tasks.

Import to Prompt Buddy

Derived skill

Files assembled from official documentation

Viewing SKILL.md

Actions Running scripts before or after a job - GitHub Docs

Instructions for executing custom scripts on self-hosted runners at specific lifecycle stages of a job to perform setup or cleanup tasks.

When To Use

Use when you need to automate environment preparation, dependency installation, or workspace cleanup on a self-hosted runner before or after a job executes.

Reference Files

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/actions-how-tos-manage-runners-running-scripts-before-or-after-a-job-git-workflow-guide.mdDocumentation regarding the implementation and exit code handling of pre- and post-job scripts on self-hosted runners.Questions about documentation regarding the implementation and exit code handling of pre- and post-job scripts on self-hosted runners.
examples/actions-how-tos-manage-runners-running-scripts-before-or-after-a-job-git.textAn example showing the configuration of the ACTIONS_RUNNER_HOOK_JOB_STARTED environment variable to execute a cleanup script on a self-hosted runner.Exact payloads, commands, or snippets shown in An example showing the configuration of the ACTIONSRUNNERHOOKJOBSTARTED environment variable to execute a cleanup scr...
examples/actions-how-tos-manage-runners-running-scripts-before-or-after-a-job-git-2.textA text snippet demonstrating how to use chmod to grant execution permissions to a script on a self-hosted runner.Exact payloads, commands, or snippets shown in A text snippet demonstrating how to use chmod to grant execution permissions to a script on a self-hosted runner.

What This Skill Covers

    • GitHub Actions / - How-tos / - Manage runners / - Self-hosted runners / - Run scripts
  • Main sections: In this article, About pre- and post-job scripts, Writing the scripts, Handling exit codes, Triggering the scripts.

Workflow

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://docs.github.com/en/actions/how-tos/manage-runners/self-hosted-runners/run-scripts