Skip to content

Commit 51c0cd2

Browse files
authored
ci: fix reporting CLI speed on PRs (#266)
And also adjust the message about imports than take more than 0.1s when there are none.
1 parent 14114a6 commit 51c0cd2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ jobs:
99
runs-on: ubuntu-latest
1010
# #no-ci in the commit log flags commit we don't want CI-validated
1111
if: ${{ !contains(github.event.head_commit.message, '#no-ci') }}
12+
permissions:
13+
pull-requests: write
1214
steps:
1315
- uses: actions/checkout@v4
1416

@@ -62,8 +64,12 @@ jobs:
6264
echo "CLI load time: $CLI_LOAD_TIME" > import-message.txt
6365
PR_HEAD="${{ github.event.pull_request.head.sha }}"
6466
[[ $PR_HEAD ]] && echo "Pull Request HEAD: $PR_HEAD" >> import-message.txt
65-
echo "Imports that take more than 0.1 s:" >> import-message.txt
66-
grep -E 'cumulative|[0-9]{6} ' importtime.txt >> import-message.txt
67+
if grep -q -E '[0-9]{6} ' importtime.txt; then \
68+
echo "Imports that take more than 0.1 s:" >> import-message.txt; \
69+
grep -E 'cumulative|[0-9]{6} ' importtime.txt >> import-message.txt; \
70+
else \
71+
echo "No imports take more than 0.1 s." >> import-message.txt; \
72+
fi
6773
cat import-message.txt
6874
echo "Full import time log:"
6975
cat importtime.txt

0 commit comments

Comments
 (0)