|
| 1 | +name: Docs - Update disk sizes |
| 2 | + |
| 3 | +# Triggers after a successful sync-from-scratch run (full or minimal node). |
| 4 | +# Downloads the disk-usage artifacts, updates docs/site/src/data/disk-sizes.json, |
| 5 | +# and opens (or updates) a draft PR against main. |
| 6 | +on: |
| 7 | + workflow_run: |
| 8 | + workflows: |
| 9 | + - "QA - Sync from scratch" |
| 10 | + - "QA - Sync from scratch (minimal node)" |
| 11 | + types: |
| 12 | + - completed |
| 13 | + branches: |
| 14 | + - release/3.* |
| 15 | + - main |
| 16 | + workflow_dispatch: |
| 17 | + inputs: |
| 18 | + run_id: |
| 19 | + description: "Workflow run ID to pull disk-usage artifacts from" |
| 20 | + required: true |
| 21 | + prune_mode: |
| 22 | + description: "Prune mode measured in that run" |
| 23 | + required: true |
| 24 | + default: "full" |
| 25 | + type: choice |
| 26 | + options: |
| 27 | + - full |
| 28 | + - minimal |
| 29 | + |
| 30 | +permissions: |
| 31 | + contents: write |
| 32 | + pull-requests: write |
| 33 | + actions: read |
| 34 | + |
| 35 | +jobs: |
| 36 | + update-disk-sizes: |
| 37 | + # For workflow_run: only proceed on success. |
| 38 | + # For workflow_dispatch: always proceed. |
| 39 | + if: > |
| 40 | + github.event_name == 'workflow_dispatch' || |
| 41 | + github.event.workflow_run.conclusion == 'success' |
| 42 | + runs-on: ubuntu-latest |
| 43 | + |
| 44 | + steps: |
| 45 | + - name: Checkout main |
| 46 | + uses: actions/checkout@v6 |
| 47 | + with: |
| 48 | + ref: main |
| 49 | + |
| 50 | + - name: Determine prune mode and source run ID |
| 51 | + run: | |
| 52 | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
| 53 | + echo "PRUNE_MODE=${{ github.event.inputs.prune_mode }}" >> $GITHUB_ENV |
| 54 | + echo "SOURCE_RUN_ID=${{ github.event.inputs.run_id }}" >> $GITHUB_ENV |
| 55 | + elif [[ "${{ github.event.workflow_run.name }}" == *"minimal"* ]]; then |
| 56 | + echo "PRUNE_MODE=minimal" >> $GITHUB_ENV |
| 57 | + echo "SOURCE_RUN_ID=${{ github.event.workflow_run.id }}" >> $GITHUB_ENV |
| 58 | + else |
| 59 | + echo "PRUNE_MODE=full" >> $GITHUB_ENV |
| 60 | + echo "SOURCE_RUN_ID=${{ github.event.workflow_run.id }}" >> $GITHUB_ENV |
| 61 | + fi |
| 62 | +
|
| 63 | + - name: Download disk usage artifacts |
| 64 | + uses: actions/download-artifact@v4 |
| 65 | + with: |
| 66 | + run-id: ${{ env.SOURCE_RUN_ID }} |
| 67 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 68 | + pattern: disk-usage-* |
| 69 | + path: ./artifacts |
| 70 | + merge-multiple: true |
| 71 | + |
| 72 | + - name: List downloaded artifacts |
| 73 | + run: ls -lh ./artifacts/ 2>/dev/null || echo "No artifacts found" |
| 74 | + |
| 75 | + - name: Set up Python |
| 76 | + uses: actions/setup-python@v5 |
| 77 | + with: |
| 78 | + python-version: "3.x" |
| 79 | + |
| 80 | + - name: Update disk-sizes.json |
| 81 | + run: | |
| 82 | + python3 docs/site/scripts/update-disk-sizes.py \ |
| 83 | + ./artifacts \ |
| 84 | + docs/site/src/data/disk-sizes.json \ |
| 85 | + ${{ env.PRUNE_MODE }} |
| 86 | +
|
| 87 | + - name: Check for changes |
| 88 | + id: diff |
| 89 | + run: | |
| 90 | + if git diff --quiet docs/site/src/data/disk-sizes.json; then |
| 91 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 92 | + echo "No changes to disk-sizes.json" |
| 93 | + else |
| 94 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 95 | + git diff docs/site/src/data/disk-sizes.json |
| 96 | + fi |
| 97 | +
|
| 98 | + - name: Configure git |
| 99 | + if: steps.diff.outputs.changed == 'true' |
| 100 | + run: | |
| 101 | + git config user.name "github-actions[bot]" |
| 102 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 103 | +
|
| 104 | + - name: Commit and push to update branch |
| 105 | + if: steps.diff.outputs.changed == 'true' |
| 106 | + run: | |
| 107 | + BRANCH="docs/auto/disk-sizes" |
| 108 | + git fetch origin $BRANCH 2>/dev/null || true |
| 109 | + git checkout -B $BRANCH |
| 110 | + git add docs/site/src/data/disk-sizes.json |
| 111 | + git commit -m "chore(docs): auto-update measured disk sizes [$(date +%Y-%m-%d)]" |
| 112 | + git push --force origin $BRANCH |
| 113 | +
|
| 114 | + - name: Create or update draft PR |
| 115 | + if: steps.diff.outputs.changed == 'true' |
| 116 | + env: |
| 117 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 118 | + run: | |
| 119 | + BRANCH="docs/auto/disk-sizes" |
| 120 | + TODAY=$(date +%Y-%m-%d) |
| 121 | + EXISTING=$(gh pr list --head $BRANCH --state open --json number --jq '.[0].number' 2>/dev/null) |
| 122 | +
|
| 123 | + if [ -z "$EXISTING" ]; then |
| 124 | + gh pr create \ |
| 125 | + --draft \ |
| 126 | + --head "$BRANCH" \ |
| 127 | + --base main \ |
| 128 | + --title "docs: auto-update disk size measurements ($TODAY)" \ |
| 129 | + --body "$(cat <<'EOF' |
| 130 | +## Automated disk size update |
| 131 | + |
| 132 | +Opened automatically by the **Docs - Update disk sizes** CI workflow after a successful sync-from-scratch run. |
| 133 | + |
| 134 | +### What changed |
| 135 | +`docs/site/src/data/disk-sizes.json` — `full` and/or `minimal` mode disk usage updated from the latest CI measurement. The hardware requirements page consumes this file directly, so merging this PR is all that's needed. |
| 136 | + |
| 137 | +### What this does NOT update |
| 138 | +- **Archive** mode: requires manual measurement from always-on snapshot machines. |
| 139 | +- **Recommended disk size** column: intentionally static (should remain a comfortable buffer above current usage). |
| 140 | + |
| 141 | +### Before merging |
| 142 | +- Values should show gradual growth vs. the previous entry — a sudden drop or doubling is suspect. |
| 143 | +- If both `full` and `minimal` runs completed today, both sets of chains are included (the branch is force-pushed by each run). |
| 144 | + |
| 145 | +🤖 Auto-generated by [update-disk-sizes.yml](/.github/workflows/update-disk-sizes.yml) |
| 146 | +EOF |
| 147 | +)" |
| 148 | + echo "Created new draft PR for branch $BRANCH" |
| 149 | + else |
| 150 | + echo "PR #$EXISTING already open for branch $BRANCH — branch updated via force-push" |
| 151 | + fi |
0 commit comments