@@ -30,8 +30,8 @@ name: Size
3030
3131on :
3232 push :
33- branches-ignore :
34- - ' dependabot/** '
33+ branches :
34+ - ' main '
3535 pull_request :
3636 branches :
3737 - ' main'
@@ -41,13 +41,14 @@ concurrency:
4141 cancel-in-progress : true
4242
4343permissions :
44- issues : write
4544 pull-requests : write
4645 contents : read
4746
4847jobs :
4948
5049 size-report :
50+ permissions :
51+ pull-requests : write
5152 runs-on : ubuntu-24.04
5253 steps :
5354 - name : Harden Runner
5859 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5960 - name : Run
6061 env :
61- OT_BASE_BRANCH : " ${{ github.base_ref }}"
6262 GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
6363 run : |
6464 ./script/check-size
6565 cat /tmp/ot-size-report/report_pr >> $GITHUB_STEP_SUMMARY
66+ - uses : actions/github-script@v7
67+ name : Post Report
68+ if : ${{ github.event_name == 'pull_request' }}
69+ id : post-report
70+ with :
71+ script : |
72+ const fs = require('fs')
73+
74+ const report = fs.readFileSync('/tmp/ot-size-report/report_pr', 'utf8');
75+ const params = {
76+ issue_number: context.issue.number,
77+ owner: context.repo.owner,
78+ repo: context.repo.repo,
79+ body: report,
80+ }
81+
82+ const response = await github.rest.issues.listComments({
83+ issue_number: context.issue.number,
84+ owner: context.repo.owner,
85+ repo: context.repo.repo,
86+ });
87+
88+ const comment = response.data.find(comment => comment.body.includes('# Size Report of **OpenThread**'))
89+
90+ if (comment) {
91+ params.comment_id = comment.id;
92+ await github.rest.issues.updateComment(params)
93+ } else {
94+ await github.rest.issues.createComment(params)
95+ }
0 commit comments