Skip to content

Commit 1b0ad74

Browse files
Copilothuangyiirene
andcommitted
Fix code review issues: improve cross-platform compatibility and reduce duplication
Co-authored-by: huangyiirene <7665279+huangyiirene@users.noreply.github.com>
1 parent 4c52dd8 commit 1b0ad74

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.github/workflows/dependabot-auto-merge.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,32 @@ jobs:
1919
with:
2020
github-token: "${{ secrets.GITHUB_TOKEN }}"
2121

22+
- name: Check if auto-mergeable
23+
id: check-update
24+
run: |
25+
UPDATE_TYPE="${{ steps.metadata.outputs.update-type }}"
26+
if [[ "$UPDATE_TYPE" == "version-update:semver-patch" ]] || [[ "$UPDATE_TYPE" == "version-update:semver-minor" ]]; then
27+
echo "auto_merge=true" >> $GITHUB_OUTPUT
28+
else
29+
echo "auto_merge=false" >> $GITHUB_OUTPUT
30+
fi
31+
2232
- name: Enable auto-merge for Dependabot PRs
23-
# Auto-merge patch and minor updates
24-
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' }}
33+
if: steps.check-update.outputs.auto_merge == 'true'
2534
run: gh pr merge --auto --squash "$PR_URL"
2635
env:
2736
PR_URL: ${{ github.event.pull_request.html_url }}
2837
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2938

3039
- name: Approve PR
31-
# Auto-approve patch and minor updates
32-
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor' }}
40+
if: steps.check-update.outputs.auto_merge == 'true'
3341
run: gh pr review --approve "$PR_URL"
3442
env:
3543
PR_URL: ${{ github.event.pull_request.html_url }}
3644
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3745

3846
- name: Comment on major updates
39-
if: ${{ steps.metadata.outputs.update-type == 'version-update:semver-major' }}
47+
if: steps.metadata.outputs.update-type == 'version-update:semver-major'
4048
uses: actions/github-script@v7
4149
with:
4250
script: |

.github/workflows/size-check.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ jobs:
5252
# Calculate sizes for main bundle files
5353
for file in "$pkg"/*.js; do
5454
if [ -f "$file" ] && [ ! -f "${file}.map" ]; then
55-
size=$(stat -f%z "$file" 2>/dev/null || stat -c%s "$file" 2>/dev/null || echo "0")
55+
# Use portable method to get file size
56+
size=$(wc -c < "$file")
5657
size_kb=$(awk "BEGIN {printf \"%.2f\", $size/1024}")
5758
5859
# Estimate gzipped size

0 commit comments

Comments
 (0)