|
| 1 | +name: Metrics Comparison and Post Comment |
| 2 | +on: |
| 3 | + workflow_run: |
| 4 | + workflows: ["E2E Tests"] |
| 5 | + types: [completed] |
| 6 | +permissions: |
| 7 | + contents: read |
| 8 | + pull-requests: write |
| 9 | +jobs: |
| 10 | + metrics-comparison: |
| 11 | + name: Compare Metrics |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + ref: ${{ github.event.repository.default_branch }} |
| 18 | + - name: Download all metrics artifacts |
| 19 | + id : download-artifacts |
| 20 | + uses: actions/download-artifact@v4 |
| 21 | + with: |
| 22 | + path: ./.metrics/ |
| 23 | + run-id: ${{ github.event.workflow_run.id }} |
| 24 | + - name: Install dependencies |
| 25 | + run: | |
| 26 | + python3 -m pip install prometheus-client |
| 27 | + npm install @actions/core @actions/github |
| 28 | + - name: Compare metrics and generate summary |
| 29 | + id: compare-metrics |
| 30 | + shell: bash |
| 31 | + run: | |
| 32 | + bash ./scripts/e2e/metrics_summary.sh |
| 33 | + - name: Extract PR number from workflow_run |
| 34 | + id: extract-pr-number |
| 35 | + run: | |
| 36 | + PR_NUMBER=$(jq -r '.workflow_run.pull_requests[0].number' <<< '${{ toJSON(github.event) }}') |
| 37 | + echo "pr_number=${PR_NUMBER}" >> $GITHUB_OUTPUT |
| 38 | + - name: Debug PR number |
| 39 | + run: | |
| 40 | + echo "Event JSON: ${{ toJSON(github.event) }}" |
| 41 | + echo "Extracted PR: ${{ steps.extract-pr-number.outputs.pr_number }}" |
| 42 | + - name: Post PR comment with combined metrics summary |
| 43 | + if: steps.compare-metrics.outputs.DIFF_FOUND == 'true' |
| 44 | + uses: thollander/actions-comment-pull-request@v3 |
| 45 | + with: |
| 46 | + file-path: ./.metrics/combined_summary.md |
| 47 | + github-token: '${{ secrets.GITHUB_TOKEN }}' |
| 48 | + comment-tag: "## Metrics Comparison Summary" |
| 49 | + pr-number: ${{ steps.extract-pr-number.outputs.pr_number }} |
0 commit comments