https://github.com/jensdll/should-run
Reuseable workflow to only run jobs on projects that have changed
https://github.com/jensdll/should-run
github-actions workflow workflow-reusable
Last synced: 27 days ago
JSON representation
Reuseable workflow to only run jobs on projects that have changed
- Host: GitHub
- URL: https://github.com/jensdll/should-run
- Owner: JensDll
- License: unlicense
- Created: 2022-02-12T22:50:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-12T21:57:04.000Z (over 3 years ago)
- Last Synced: 2025-03-15T02:44:23.054Z (about 1 year ago)
- Topics: github-actions, workflow, workflow-reusable
- Homepage:
- Size: 22.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Reuseable should run workflow
Only run jobs in projects that have changed. Useful for monorepo workflows. See [`./.github/workflows/main.yaml`](./.github/workflows/main.yaml) for the implementation.
## Usage
```yaml
jobs:
should-run:
uses: JensDll/should-run/.github/workflows/main.yaml@main
with:
# A list of projects to match against as full paths.
# Required: true
projects: services/web services/api services/db
# Filter to use on git diff.
# Required: false
# Default: ''
diff_filter: d
web:
if: fromJSON(needs.should-run.outputs.result)['services/web'] == 'true'
runs-on: ubuntu-latest
needs: should-run
steps:
- run: echo "Hello web"
api:
if: fromJSON(needs.should-run.outputs.result)['services/api'] == 'true'
runs-on: ubuntu-latest
needs: should-run
steps:
- run: echo "Hello api"
db:
if: fromJSON(needs.should-run.outputs.result)['services/db'] == 'true'
runs-on: ubuntu-latest
needs: should-run
steps:
- run: echo "Hello db"
```