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. #1

Merged
merged 1 commit 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
43 changes: 26 additions & 17 deletions .github/workflows/code-size-report.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,41 @@
name: Code Size Report
name: Code Report

on:
workflow_dispatch:
inputs:
pr_number:
description: 'The pull request number'
required: true

permissions:
pull-requests: write
workflow_run:
workflows: ['🔥 Firmware Build']
types:
- completed

jobs:
code-size-report:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
download-artifact:
runs-on: ubuntu-latest
steps:
- name: '📝 Generate report'
id: generate_report
- name: '↓ Download code size report'
uses: actions/download-artifact@v4
with:
pattern: "code-size-report.md"
path: ${GITHUB_WORKSPACE}
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}

- name: '📝 Check report'
run: |
CODE_SIZE_REPORT=code_size_report.md
echo "Test" > ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT}
ls -1 -R
CODE_SIZE_REPORT=${GITHUB_WORKSPACE}/code_size_report.md
cat ${CODE_SIZE_REPORT}

PR_NUMBER=$(jq -r '.workflow_run.pull_requests[0].number' < "$GITHUB_EVENT_PATH")
echo "Pull Request Number: $PR_NUMBER"

if [ -s ${GITHUB_WORKSPACE}/${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@v2
with:
pr_number: ${{ github.event.pull_request.number }}
filePath: ${{ github.workspace }}/${{ steps.generate_report.outputs.code_size_report }}
pr_number: ${{ steps.generate_report.outputs.pr_number }}
filePath: ${{ steps.generate_report.outputs.code_size_report }}
23 changes: 16 additions & 7 deletions .github/workflows/firmware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,22 @@ on:

jobs:
code-size-report:
needs: build-firmware
runs-on: ubuntu-22.04
steps:
- name: Trigger Code Size Report
uses: benc-uk/workflow-dispatch@v1
- name: '📝 Generate report'
id: generate_report
run: |
CODE_SIZE_REPORT=code-size-report.md
echo "Test" > ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT}
if [ -s ${GITHUB_WORKSPACE}/${CODE_SIZE_REPORT} ]; then
echo "code_size_report=${CODE_SIZE_REPORT}" >> $GITHUB_OUTPUT
fi

- name: '⬆ Upload code report'
if: steps.generate_report.outputs.code_size_report != ''
uses: actions/upload-artifact@v4
with:
workflow: code-size-report.yml
token: ${{ secrets.GITHUB_TOKEN }}
inputs:
pr_number: ${{ github.event.pull_request.number }}
overwrite: true
name: ${{ steps.generate_report.outputs.code_size_report }}
path: ${{ github.workspace }}/${{ steps.generate_report.outputs.code_size_report }}
if-no-files-found: error