Files
iroh/.github/workflows/cleanup.yaml
Asmir Avdicevic dbe5112cb8 fix: configure git identity in cleanup workflow
## Description

The clean_docs_branch job fails with "fatal: empty ident name" because
no git user.name/email is configured. Also handles the case where there
are no old docs to clean up.

✅ workflow
https://github.com/n0-computer/iroh/actions/runs/21824443730/job/62965614616

## 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.
- [ ] List all breaking changes in the above "Breaking Changes" section.
- [ ] Open an issue or PR on any number0 repos that are affected by this
breaking change. Give guidance on how the updates should be handled or
do the actual updates themselves. The major ones are:
    - [ ] [`quic-rpc`](https://github.com/n0-computer/quic-rpc)
    - [ ] [`iroh-gossip`](https://github.com/n0-computer/iroh-gossip)
    - [ ] [`iroh-blobs`](https://github.com/n0-computer/iroh-blobs)
    - [ ] [`dumbpipe`](https://github.com/n0-computer/dumbpipe)
    - [ ] [`sendme`](https://github.com/n0-computer/sendme)
2026-02-11 12:08:31 +01:00

49 lines
1.1 KiB
YAML

# Run tests using the beta Rust compiler
name: Cleanup
on:
schedule:
# 06:50 UTC every Monday
- cron: '50 6 * * 1'
workflow_dispatch:
concurrency:
group: beta-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IROH_FORCE_STAGING_RELAYS: "1"
jobs:
clean_docs_branch:
permissions:
issues: write
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: generated-docs-preview
- name: Clean docs branch
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
cd pr/
# keep the last 25 prs
dirs=$(ls -1d [0-9]* | sort -n)
total_dirs=$(echo "$dirs" | wc -l)
dirs_to_remove=$(echo "$dirs" | head -n $(($total_dirs - 25)))
if [ -n "$dirs_to_remove" ]; then
echo "$dirs_to_remove" | xargs rm -rf
fi
git add .
git diff --cached --quiet && echo "Nothing to clean up" && exit 0
git commit -m "Cleanup old docs"
git push