Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update workflows #5

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 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'
- 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