-
-
Notifications
You must be signed in to change notification settings - Fork 808
34 lines (31 loc) · 1.16 KB
/
reposize.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
name: Check repo size
on: [pull_request]
jobs:
clone:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- uses: actions/checkout@v1
- uses: jwalton/gh-find-current-pr@v1
id: findpr
with:
state: all
- name: Repository size should be less than 90MB
env:
PR: ${{ steps.findpr.outputs.pr }}
shell: pwsh
run: |
cd /tmp
gh repo clone dataplat/dbatools
cd /tmp/dbatools
Write-Output "Checking out $env:PR"
gh pr checkout $env:PR
$objects = git count-objects -v
$sizepack = $objects -split '`n' | Where-Object { $PSItem -match "size-pack" }
$size = $sizepack -split " " | Select-Object -Last 1
Write-Output "Repo size is $size"
# old size = 110299 or 250000+
if ($size -gt 95000) { # Size is 89836, so 95000 should last a while
throw "This clone is outdated. Please reclone your repo and resubmit with the slimmed down repo. See https://github.com/dataplat/dbatools/pull/8637 for more information."
}