Skip to content

Commit

Permalink
Merge pull request #1 from iabdalkader/update_workflows
Browse files Browse the repository at this point in the history
Update workflows.
  • Loading branch information
iabdalkader authored Jul 25, 2024
2 parents 9a60551 + 33d1bd2 commit d3f1b50
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 24 deletions.
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

0 comments on commit d3f1b50

Please sign in to comment.