Skip to content

Hotpath comment

Hotpath comment #2412

name: Hotpath comment
on:
# zizmor: ignore[dangerous-triggers] intentional two-workflow split: profile
# workflow has read-only permissions, this one only reads artifacts and posts
# a PR comment. PR metadata is read from artifacts written by the profile
# workflow using github.event.pull_request context (set by GitHub, not the
# PR author).
workflow_run:
workflows: ["Hotpath profile"]
types:
- completed
concurrency:
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}
cancel-in-progress: ${{ github.event.workflow_run.head_branch != 'main' }}
defaults:
run:
shell: bash
permissions:
contents: read
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with: { persist-credentials: false }
- run: rustup update stable && rustup default stable
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: profile-metrics
path: /tmp/metrics/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Install hotpath-utils CLI
run: cargo install hotpath --features=utils --bin hotpath-utils --locked
- name: Post PR comment
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
export GITHUB_BASE_REF=$(cat /tmp/metrics/base_ref.txt)
export GITHUB_HEAD_REF=$(cat /tmp/metrics/head_ref.txt)
hotpath-utils profile-pr \
--head-metrics /tmp/metrics/head_timing.json \
--base-metrics /tmp/metrics/base_timing.json \
--github-token "$GH_TOKEN" \
--pr-number "$(cat /tmp/metrics/pr_number.txt)" \
--benchmark-id "timing"