From 4eaab2b123f66855a341c9645abec2b89ab676c0 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 25 Jul 2024 11:56:22 +0300 Subject: [PATCH 1/2] update workflows --- .github/workflows/code-size-report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/code-size-report.yml b/.github/workflows/code-size-report.yml index f348cf7..8f4219f 100644 --- a/.github/workflows/code-size-report.yml +++ b/.github/workflows/code-size-report.yml @@ -18,7 +18,7 @@ jobs: run-id: ${{ github.event.workflow_run.id }} github-token: ${{ github.token }} - - name: '📝 Check Report' + - name: '📝 Check report' run: | ls -1 -R ${GITHUB_WORKSPACE} CODE_SIZE_REPORT=code-size-report.md From def311ed3bafad4be32f2a2dace1b1f7cf3a1f37 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Thu, 25 Jul 2024 12:07:41 +0300 Subject: [PATCH 2/2] Update workflows. --- .github/workflows/code-size-report.yml | 22 +++++++++++++++------- .github/workflows/firmware.yml | 4 ++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/code-size-report.yml b/.github/workflows/code-size-report.yml index 8f4219f..0685791 100644 --- a/.github/workflows/code-size-report.yml +++ b/.github/workflows/code-size-report.yml @@ -14,22 +14,30 @@ jobs: - name: '↓ Download code size report' uses: actions/download-artifact@v4 with: - name: "code-size-report" + name: code-size-report run-id: ${{ github.event.workflow_run.id }} github-token: ${{ github.token }} - name: '📝 Check report' run: | + # List the contents of the workspace to verify the file exists ls -1 -R ${GITHUB_WORKSPACE} - CODE_SIZE_REPORT=code-size-report.md - cat ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT} - - PR_NUMBER=$(jq -r '.workflow_run.pull_requests[0].number' < "$GITHUB_EVENT_PATH") + + # Get the filename matching the pattern *.md (assuming there is only one such file) + 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 .md + PR_NUMBER=$(basename "${CODE_SIZE_REPORT}" .md) echo "Pull Request Number: $PR_NUMBER" - - if [ -s ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT} ]; then + + # 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' diff --git a/.github/workflows/firmware.yml b/.github/workflows/firmware.yml index 4a37514..b5935e9 100644 --- a/.github/workflows/firmware.yml +++ b/.github/workflows/firmware.yml @@ -11,9 +11,9 @@ jobs: - name: '📝 Generate report' id: generate_report run: | - CODE_SIZE_REPORT=code-size-report.md + CODE_SIZE_REPORT=${{ github.event.pull_request.number }}.md echo "Test" > ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT} - if [ -s ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT} ]; then + if [ -s ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT}/report.md ]; then echo "code_size_report=${CODE_SIZE_REPORT}" >> $GITHUB_OUTPUT fi