Skip to content

hotpath relay

hotpath relay #208

Workflow file for this run

name: hotpath relay
on:
workflow_run:
workflows: ["hotpath benchmark"]
types: [completed]
jobs:
relay:
uses: pawurb/hotpath-rs/.github/workflows/hotpath-relay.yml@3c6a2b5dd994da3db5a3d23e1cc6b91c542bec2a # v0.28.5
permissions:
actions: read # download the artifact of the benchmark run
id-token: write # authenticate the upload
pull-requests: read # find the pull request the run belongs to
with:
benchmark: mlt-convert
artifact_name: hotpath-report
report_file: report.json
size-diff:
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
actions: read # download the artifact of the benchmark run
contents: read
pull-requests: write # post the comment
env:
COMMENT_MARKER: '<!-- bench-comment:mlt-size-diff -->'
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: taiki-e/install-action@f7e5d7c961414b23f5b25b2da9294395d08513ad # v2.87.26
with: { tool: 'just' }
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v3.1.0-node20
with:
name: size-metrics
path: /tmp/metrics/
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Compose comment
run: |
set -euo pipefail
{
echo "<details><summary>Per-tile encoded size diff</summary>"
echo
just rust::size-diff /tmp/metrics/base_sizes.db /tmp/metrics/head_sizes.db
echo
echo "</details>"
echo
echo "$COMMENT_MARKER"
} > /tmp/comment.md
- name: Post or update PR comment
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.event.workflow_run.repository.full_name }}
run: |
set -euo pipefail
PR_NUMBER=$(grep -E '^[0-9]+$' /tmp/metrics/pr_number.txt)
EXISTING=$(gh api "repos/$REPO/issues/$PR_NUMBER/comments" --paginate --jq ".[] | select(.body | contains(\"$COMMENT_MARKER\")) | .id" | head -n1)
if [ -n "$EXISTING" ]; then
gh api -X PATCH "repos/$REPO/issues/comments/$EXISTING" -F body=@/tmp/comment.md
else
gh api -X POST "repos/$REPO/issues/$PR_NUMBER/comments" -F body=@/tmp/comment.md
fi