Files
noq/.github/workflows/cleanup.yaml
Asmir Avdicevic c334d2da21 ci(secruity): ensure locked cargo files and dependabot cooldown (#788)
## Description

- Uses `--locked` to ensure we only use deps from the lock file
- Adds cooldown period to dependabot
- pins actions versions
- introduces zizimor and pinact

## Breaking Changes

<!-- Optional, if there are any breaking changes document them,
including how to migrate older code. -->

## Notes & open questions

<!-- Any notes, remarks or open questions you have to make about the -->
<!-- PR. -->

## Change checklist
<!-- Remove any that are not relevant. -->
- [ ] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [ ] Tests if relevant.
- [ ] All breaking changes documented.
- [ ] This PR was created by a human that thought critically about the
      proposed change and wrote an as clear and concise description as
      they could.
- [ ] This PR isn't slop, and is carefully crafted to do have the
      intented effect.
- [ ] `cargo make` passes locally.

---------

Co-authored-by: Friedel Ziegelmayer <me@dignifiedquire.com>
2026-08-20 14:00:43 +00:00

57 lines
1.5 KiB
YAML

# Cleanup old generated docs previews
name: Cleanup
on:
schedule:
# 06:50 UTC every Monday
- cron: '50 6 * * 1'
workflow_dispatch:
concurrency:
group: cleanup-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Default to read-only; jobs that need more grant it explicitly.
permissions:
contents: read
jobs:
clean_docs_branch:
timeout-minutes: 45
permissions:
issues: write
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
ref: generated-docs-preview
# stays on: this job pushes with a bare `git push`
persist-credentials: true
- name: Clean docs branch
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
cd pr/
# keep the last 10 prs
mapfile -t dirs < <(ls -1d [0-9]* 2>/dev/null | sort -n)
if [ "${#dirs[@]}" -le 10 ]; then
echo "only ${#dirs[@]} PR dirs, nothing to prune"
exit 0
fi
printf '%s\n' "${dirs[@]:0:${#dirs[@]}-10}" | xargs rm -rf
git add -A .
if git diff --cached --quiet; then
echo "nothing staged, branch already clean"
exit 0
fi
git commit -m "Cleanup old docs"
git push