-
Notifications
You must be signed in to change notification settings - Fork 1
46 lines (40 loc) · 1.47 KB
/
code-size-report.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Code Report
on:
workflow_run:
workflows: ['🔥 Firmware Build']
types:
- completed
jobs:
download-artifact:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: '↓ Download code size report'
uses: actions/download-artifact@v4
with:
name: code-size-report
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: '📝 Check Report'
id: generate_report
run: |
# Get the filename matching the pattern *.md
CODE_SIZE_REPORT=$(ls ${GITHUB_WORKSPACE}/*.md)
echo "Code Size Report: ${CODE_SIZE_REPORT}"
# Extract the PR number from the filename
# Assuming the filename format is <pr_number>.md
PR_NUMBER=$(basename "${CODE_SIZE_REPORT}" .md)
echo "Pull Request Number: $PR_NUMBER"
# Check if the report file is not empty
if [ -s "${CODE_SIZE_REPORT}" ]; then
echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT
echo "code_size_report=${CODE_SIZE_REPORT}" >> $GITHUB_OUTPUT
else
echo "The report file is empty."
fi
- name: '📝 Post report'
if: steps.generate_report.outputs.code_size_report != ''
uses: thollander/actions-comment-pull-request@v2
with:
pr_number: ${{ steps.generate_report.outputs.pr_number }}
filePath: ${{ steps.generate_report.outputs.code_size_report }}