openmv/.github/workflows/code-size-report.yml
dependabot[bot] b53c744a77
build(deps): bump actions/download-artifact from 4 to 5
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-08-06 15:05:40 +00:00

50 lines
1.5 KiB
YAML

name: '📝 Code Size Report'
on:
workflow_run:
workflows: ['🔥 Firmware Build']
types:
- completed
jobs:
post-code-report:
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
runs-on: ubuntu-24.04
steps:
- name: '↓ Download code size report'
uses: actions/download-artifact@v5
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"
# Set the outputs for the following step
if [ -s "${CODE_SIZE_REPORT}" ]; then
echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT
echo "code_size_report=${CODE_SIZE_REPORT}" >> $GITHUB_OUTPUT
fi
- name: '📝 Post report'
if: steps.generate_report.outputs.code_size_report != ''
uses: thollander/actions-comment-pull-request@v3.0.1
with:
mode: upsert
comment-tag: codesize
pr-number: ${{ steps.generate_report.outputs.pr_number }}
file-path: ${{ steps.generate_report.outputs.code_size_report }}