blob: cc40e2709a19c42e6582d4a0f209ec25ea9aaf11 (
plain)
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
|
name: "Check file size"
description: "Fails a file exceeds a given size limit"
inputs:
artifact:
description: "Path to the file"
required: true
max_size:
description: "Maximum allowed size in bytes"
required: true
runs:
using: "composite"
steps:
- name: Check file size
shell: bash
run: |
if [ -f "${{ inputs.artifact }}" ]; then
if [ "$(uname)" = "Darwin" ]; then
SIZE=$(stat -f %z "${{ inputs.artifact }}")
else
SIZE=$(stat -c %s "${{ inputs.artifact }}")
fi
echo "File size: $SIZE bytes"
echo "Size limit: ${{ inputs.max_size }} bytes"
if [ "$SIZE" -gt "${{ inputs.max_size }}" ]; then
echo "Error: Binary size exceeds limit."
exit 1
fi
else
echo "Error: File not found!"
exit 1
fi
|