Skip to content

Commit 4a18b2a

Browse files
committed
magic header
1 parent 42e93ad commit 4a18b2a

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

.github/workflows/size.yml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ name: Size
3030

3131
on:
3232
push:
33-
branches:
34-
- 'main'
33+
branches-ignore:
34+
- 'dependabot/**'
3535
pull_request:
3636
branches:
3737
- 'main'
@@ -40,10 +40,6 @@ concurrency:
4040
group: ${{ github.workflow }}-${{ github.event.pull_request.number || (github.repository == 'openthread/openthread' && github.run_id) || github.ref }}
4141
cancel-in-progress: true
4242

43-
permissions:
44-
pull-requests: write
45-
contents: read
46-
4743
jobs:
4844

4945
size-report:
@@ -60,10 +56,11 @@ jobs:
6056
- name: Run
6157
env:
6258
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
59+
PR_NUMBER: "${{ github.event.pull_request.number }}"
6360
run: |
6461
./script/check-size
6562
cat /tmp/ot-size-report/report_pr >> $GITHUB_STEP_SUMMARY
66-
- uses: actions/github-script@v7
63+
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
6764
name: Post Report
6865
if: ${{ github.event_name == 'pull_request' }}
6966
id: post-report
@@ -85,7 +82,8 @@ jobs:
8582
repo: context.repo.repo,
8683
});
8784
88-
const comment = response.data.find(comment => comment.body.includes('# Size Report of **OpenThread**'))
85+
const kMagicHeader = '<!-- Size Report of **OpenThread** -->'
86+
const comment = response.data.find(comment => comment.body.startsWith(kMagicHeader))
8987
9088
if (comment) {
9189
params.comment_id = comment.id;

script/check-size

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ readonly OT_REPORT_FILE_TABLE
4444
OT_REPORT_FILE_PR="${OT_TMP_DIR}/report_pr"
4545
readonly OT_REPORT_FILE_TABLE
4646

47-
PR_NUMBER="$([[ $GITHUB_REF_NAME =~ ([0-9]+)/merge ]] && echo "${BASH_REMATCH[1]}")"
47+
PR_NUMBER="${PR_NUMBER:-}"
4848

4949
setup_arm_gcc_7()
5050
{
@@ -169,9 +169,9 @@ generate_table_header()
169169
} >>"${OT_REPORT_FILE_TABLE}"
170170

171171
{
172-
printf "# Size Report of **OpenThread**\n"
172+
printf "<!-- Size Report of **OpenThread** -->\n"
173173
if [[ -n $PR_NUMBER ]]; then
174-
printf "> Merging #${PR_NUMBER} into ${GITHUB_BASE_REF}\n\n"
174+
printf "> Merging #%s into %s\n\n" "${PR_NUMBER}" "${GITHUB_BASE_REF}"
175175
fi
176176
printf "| name | branch | text | data | bss | total |\n"
177177
printf "| :----: | :------: | -----: | ----: | ---: | ----: |\n"

0 commit comments

Comments
 (0)