Reusable GitHub Actions workflows for Ystorian repositories.
The detect_changes.yaml workflow detects relevant file changes with
dorny/paths-filter.
It reads the .github/filters.yaml file of the calling repository.
- On push: the
runoutput is the result of thefilterinput. - On other events: the
runoutput is alwaystrue.
jobs:
changes:
name: Workflows
uses: ystorian/workflows/.github/workflows/detect_changes.yaml@main
permissions:
contents: read
with:
filter: ci # Optional, default is `ci`.
test:
needs: changes
if: needs.changes.outputs.run == 'true'The status_check.yaml workflow gives one required status check for a workflow.
It fails when a job in needs failed or was cancelled.
Skipped jobs pass.
jobs:
status:
name: Workflows
needs: [changes, check, test]
if: always()
uses: ystorian/workflows/.github/workflows/status_check.yaml@main
with:
needs: ${{ toJSON(needs) }}In branch protection, require only Workflows / Status check.
The cargo_cache_cleanup.yaml workflow deletes the superseded Cargo caches of the current ref.
It keeps the newest cache for each group of key fields.
The cache keys must look like cargo-<os>-<arch>-<rustc>-<lock>[-<run_id>].
The default group is the first 4 fields: cargo-<os>-<arch>-<rustc>.
jobs:
cargo-cache-cleanup:
name: Workflows
needs: test
if: github.ref == 'refs/heads/main'
uses: ystorian/workflows/.github/workflows/cargo_cache_cleanup.yaml@main
permissions:
actions: write # Required to list and delete the cache entries.
with:
fields: 4 # Optional, default is `4`.Pin the workflows to a commit SHA. Update them with just update_actions.