Skip to content

Commit f4c8ebe

Browse files
authored
Merge pull request #8 from savinmikhail/codex/design-badge-for-optimization-status
feat: add dist-size badge workflow
2 parents c748f63 + 19ba983 commit f4c8ebe

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

.github/workflows/dist-size.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: dist-size
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
8+
jobs:
9+
check:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: '8.2'
18+
coverage: none
19+
- name: Install dependencies
20+
run: composer install --no-interaction --no-progress
21+
- name: Run dist size check
22+
id: dist
23+
run: |
24+
set +e
25+
bin/dist-size-optimizer check --dry-run > /tmp/out.txt
26+
exit_code=$?
27+
cat /tmp/out.txt
28+
if [ $exit_code -eq 0 ]; then
29+
echo '{"schemaVersion":1,"label":"dist-size","message":"optimized","color":"brightgreen"}' > dist-size-status.json
30+
else
31+
echo '{"schemaVersion":1,"label":"dist-size","message":"needs optimization","color":"red"}' > dist-size-status.json
32+
fi
33+
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
34+
- name: Commit status
35+
if: github.event_name == 'push'
36+
uses: stefanzweifel/git-auto-commit-action@v5
37+
with:
38+
commit_message: 'chore: update dist-size badge [skip ci]'
39+
file_pattern: dist-size-status.json

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Dist Size Optimizer
22

3+
![dist-size status](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fsavinmikhail%2Fdist-size-optimizer%2Fmain%2Fdist-size-status.json)
4+
35
A command-line tool that helps you optimize your package distribution size by automatically managing `.gitattributes` export-ignore rules.
46

57
> **Note**: This package was previously known as `export-ignore-check`. The functionality remains the same, but the name better reflects its purpose of optimizing distribution size.

dist-size-status.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"schemaVersion": 1,
3+
"label": "dist-size",
4+
"message": "optimized",
5+
"color": "brightgreen"
6+
}

0 commit comments

Comments
 (0)