summaryrefslogtreecommitdiff
path: root/.github/workflows/metrics_comment.yml
diff options
context:
space:
mode:
authorhathach <[email protected]>2025-12-11 19:01:33 +0700
committerhathach <[email protected]>2025-12-11 19:01:33 +0700
commitc7f7dc6ee1f4f56ccb86adabb2ca3f14c212e985 (patch)
tree772c9f65652a4872e147e35fec5d4e856fef163a /.github/workflows/metrics_comment.yml
parentb73003745fb18818574baa89367fd618c36ad8b0 (diff)
separate metric comment into its own workflow in order to work with forked PR
Diffstat (limited to '.github/workflows/metrics_comment.yml')
-rw-r--r--.github/workflows/metrics_comment.yml38
1 files changed, 38 insertions, 0 deletions
diff --git a/.github/workflows/metrics_comment.yml b/.github/workflows/metrics_comment.yml
new file mode 100644
index 000000000..2f1b0d631
--- /dev/null
+++ b/.github/workflows/metrics_comment.yml
@@ -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 }}