Skip to content

Commit

Permalink
Update workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
iabdalkader committed Jul 25, 2024
1 parent 4eaab2b commit def311e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/code-size-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <pr_number>.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'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/firmware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit def311e

Please sign in to comment.