Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eviden-actions/clean-self-hosted-runner
GitHub Actions to clean the working directory on self hosted runners
https://github.com/eviden-actions/clean-self-hosted-runner
actions cleanup eviden github github-actions self-hosted-runner workflows
Last synced: 8 days ago
JSON representation
GitHub Actions to clean the working directory on self hosted runners
- Host: GitHub
- URL: https://github.com/eviden-actions/clean-self-hosted-runner
- Owner: eviden-actions
- License: mit
- Created: 2022-02-25T15:05:12.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-09T22:34:04.000Z (7 months ago)
- Last Synced: 2024-04-10T01:18:53.977Z (7 months ago)
- Topics: actions, cleanup, eviden, github, github-actions, self-hosted-runner, workflows
- Language: Shell
- Homepage:
- Size: 1.91 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# clean-self-hosted-runner
GitHub Actions to clean the working directory on self hosted runners
[![Release](https://github.com/eviden-actions/clean-self-hosted-runner/actions/workflows/on_push.yml/badge.svg#main)](https://github.com/eviden-actions/clean-self-hosted-runner/actions/workflows/on_push.yml)
Per the [official documentation](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners), 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.
## Usage
```yaml
steps:
- uses: eviden-actions/clean-self-hosted-runner@v1
```### Options
To disable the cleanup job (e.g. for debugging purpose), set the [environment variable](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#env) `DISABLE_RUNNER_CLEANUP` to **true**
### Example
This is an example of a simple NPM build workflow that will clean the working directory after each execution.
```yaml
name: My Workflowon:
pull_request:
types: [opened, synchronize, reopened]jobs:
build:
runs-on: self-hostedsteps:
- 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
```