Merge pull request #1 from iabdalkader/update_workflows #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Code Report | ||
on: | ||
workflow_run: | ||
workflows: ['🔥 Firmware Build'] | ||
types: | ||
- completed | ||
jobs: | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
download-artifact: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- 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: | | ||
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: ${{ steps.generate_report.outputs.pr_number }} | ||
filePath: ${{ steps.generate_report.outputs.code_size_report }} |