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.
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
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/actions-how-tos-manage-runners-running-scripts-before-or-after-a-job-git-workflow-guide.md | Documentation 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.text | An 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.text | A 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
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - 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
