Skip to content

Commit

Permalink
👷 Add README.md & CHANGELOG.md size check for publishable tests (#…
Browse files Browse the repository at this point in the history
…1977)

Inspired by dart-lang/pub-dev#6012.

### New Pull Request Checklist

- [x] I have read the
[Documentation](https://pub.dev/documentation/dio/latest/)
- [x] I have searched for a similar pull request in the
[project](https://github.com/cfug/dio/pulls) and found none
- [x] I have updated this branch with the latest `main` branch to avoid
conflicts (via merge from master or rebase)
- [ ] I have added the required tests to prove the fix/feature I'm
adding
- [ ] I have updated the documentation (if necessary)
- [x] I have run the tests without failures
- [ ] I have updated the `CHANGELOG.md` in the corresponding package
  • Loading branch information
AlexV525 authored Sep 22, 2023
1 parent 179d2ff commit 4493f1e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/publishable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@ jobs:
directory: ["dio", "plugins/cookie_manager", "plugins/http2_adapter", "plugins/native_dio_adapter"]
steps:
- uses: actions/checkout@v3
- name: "Check documents file size < 128kb"
working-directory: ${{ matrix.directory }}
run: |
limit_size=$(expr 128 \* 1024) # Maximum 128kb.
changelog_size=$(stat -c%s CHANGELOG.md)
echo "CHANGELOG.md file size: $changelog_size."
if [ $changelog_size -gt $limit_size ]; then
echo "CHANGELOG.md exceeded the maximum size: $changelog_size > $limit_size."
exit 1
fi
readme_size=$(stat -c%s README.md)
echo "README.md file size: $readme_size."
if [ $readme_size -gt $limit_size ]; then
echo "README.md exceeded the maximum size: $readme_size > $limit_size."
exit 1
fi
if [ -f README_ZH.md ]; then
readme_zh_size=$(stat -c%s README_ZH.md)
echo "README_ZH.md file size: $readme_zh_size."
if [ readme_zh_size -gt $limit_size ]; then
echo "README_ZH.md exceeded the maximum size: $readme_zh_size > $limit_size."
exit 1
fi
fi
- uses: subosito/flutter-action@v2
- run: |
if grep -q "flutter:" "${{ matrix.directory }}/pubspec.yaml"; then
Expand Down
2 changes: 1 addition & 1 deletion dio/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,4 @@ First Stable version for 2.x

- Initial version, created by Stagehand

[Migration Guide]: ./migration_guide.md
[Migration Guide]: doc/migration_guide.md

0 comments on commit 4493f1e

Please sign in to comment.