1616 runs-on : ubuntu-latest
1717
1818 steps :
19- # - name: Setup environment
20- # run: |
21- # apt-get update
22- # apt-get install -y git bc
23-
2419 - name : Checkout code
2520 uses : actions/checkout@v4
2621 with :
8580 const largeFiles = `${{ steps.check-sizes.outputs.large_files }}`;
8681
8782 try {
88- // Only create status check if we have permission (not a fork PR)
89- if (context.payload.pull_request.head.repo.full_name === context.payload.repository.full_name) {
90- await github.rest.repos.createCommitStatus({
91- owner: context.payload.repository.owner.login,
92- repo: context.payload.repository.name,
93- sha: context.payload.pull_request.head.sha,
94- state: hugeFiles ? 'failure' : 'success',
95- context: 'File Size Check',
96- description: hugeFiles ? 'Files over 40MB found' : 'All files within size limits',
97- target_url: `https://github.com/${context.payload.repository.owner.login}/${context.payload.repository.name}/actions/runs/${context.runId}`
98- });
99- }
100-
101- // Comments should work for both fork and non-fork PRs
83+ // Only comment if issues were found
10284 if (hugeFiles || largeFiles) {
10385 let comment = '## ⚠️ File Size Check Results\n\n';
10486
@@ -121,11 +103,5 @@ jobs:
121103 }
122104 } catch (error) {
123105 console.error('Error:', error);
124- console.error('Context:', JSON.stringify(context.payload, null, 2));
125- // Only ignore status check permission errors for fork PRs
126- if (error.status === 403 && context.payload.pull_request.head.repo.full_name !== context.payload.repository.full_name) {
127- console.log('Ignoring status check permission error for fork PR');
128- } else {
129- core.setFailed(error.message);
130- }
106+ core.setFailed(error.message);
131107 }
0 commit comments