mirror of
https://github.com/hathach/tinyusb.git
synced 2026-02-04 22:05:39 +00:00
separate metric comment into its own workflow in order to work with forked PR
This commit is contained in:
16
.github/workflows/build.yml
vendored
16
.github/workflows/build.yml
vendored
@ -130,12 +130,18 @@ jobs:
|
||||
cp metrics.md metrics_compare.md
|
||||
fi
|
||||
|
||||
- name: Post Code Metrics as PR Comment
|
||||
if: github.event_name != 'push'
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
- name: Save PR number
|
||||
if: github.event_name == 'pull_request'
|
||||
run: echo ${{ github.event.number }} > pr_number.txt
|
||||
|
||||
- name: Upload Metrics Comment Artifact
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
header: code-metrics
|
||||
path: metrics_compare.md
|
||||
name: metrics-comment
|
||||
path: |
|
||||
metrics_compare.md
|
||||
pr_number.txt
|
||||
|
||||
# ---------------------------------------
|
||||
# Build Make/CMake on Windows/MacOS
|
||||
|
||||
38
.github/workflows/metrics_comment.yml
vendored
Normal file
38
.github/workflows/metrics_comment.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: Metrics Comment
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Build"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
post-comment:
|
||||
runs-on: ubuntu-latest
|
||||
if: >
|
||||
github.event.workflow_run.event == 'pull_request' &&
|
||||
github.event.workflow_run.conclusion == 'success'
|
||||
permissions:
|
||||
pull-requests: write
|
||||
steps:
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
run-id: ${{ github.event.workflow_run.id }}
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
name: metrics-comment
|
||||
|
||||
- name: Read PR Number
|
||||
id: pr_number
|
||||
run: |
|
||||
if [ -f pr_number.txt ]; then
|
||||
echo "number=$(cat pr_number.txt)" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Post Code Metrics as PR Comment
|
||||
if: steps.pr_number.outputs.number != ''
|
||||
uses: marocchino/sticky-pull-request-comment@v2
|
||||
with:
|
||||
header: code-metrics
|
||||
path: metrics_compare.md
|
||||
number: ${{ steps.pr_number.outputs.number }}
|
||||
Reference in New Issue
Block a user