GitHub Action
Clean self-hosted runner
v1.3.14
Latest version
GitHub Actions to clean the working directory on self hosted runners
Per the official documentation, self-hosted runners don't need to have a clean instance for every job execution. Your job might however need a clean working directory for every execution.
The goal of this action is to clean the working directory at the beginning or the end of each job.
steps:
- uses: eviden-actions/clean-self-hosted-runner@v1
To disable the cleanup job (e.g. for debugging purpose), set the environment variable DISABLE_RUNNER_CLEANUP
to true
This is an example of a simple NPM build workflow that will clean the working directory after each execution.
name: My Workflow
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- run: npm ci
- run: npm run build
- uses: eviden-actions/clean-self-hosted-runner@v1
if: ${{ always() }} # Run even if previous steps in the job fail or are canceled