Skip to content
39 changes: 33 additions & 6 deletions .github/workflows/perf-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,37 @@

permissions:
contents: read
pull-requests: write

Check failure on line 13 in .github/workflows/perf-benchmark.yml

View workflow job for this annotation

GitHub Actions / Lint GitHub Actions (zizmor)

excessive-permissions

perf-benchmark.yml:13: overly broad permissions: pull-requests: write is overly broad at the workflow level
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Outdated

jobs:
post-pending:
name: Post Pending Comment
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.head.repo.fork == false }}
Comment thread
yamadashy marked this conversation as resolved.
steps:
- name: Post or update pending comment
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
COMMENT_MARKER="<!-- repomix-perf-benchmark -->"
BODY="${COMMENT_MARKER}
## ⚡ Performance Benchmark

ベンチマーク取得中...

[Workflow run](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})"

# Find existing comment by marker
COMMENT_ID=$(gh api "repos/${GH_REPO}/issues/${PR_NUMBER}/comments" --paginate --jq ".[] | select(.body | startswith(\"${COMMENT_MARKER}\")) | .id" | head -1)

if [ -n "$COMMENT_ID" ]; then
gh api "repos/${GH_REPO}/issues/comments/${COMMENT_ID}" -X PATCH -f body="$BODY"
else
gh pr comment "$PR_NUMBER" --body "$BODY"
fi

benchmark:
name: Benchmark (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -114,8 +143,6 @@
needs: benchmark
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
permissions:
pull-requests: write
steps:
- uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
Expand All @@ -131,7 +158,7 @@
local file="results/bench-result-${os}/bench-result.json"

if [ ! -f "$file" ]; then
echo "| ${label} | - | - | - |"
echo "| ${label} | - | - |"
return
fi

Expand All @@ -158,15 +185,15 @@
diff_pct="N/A"
fi

echo "| ${label} | ${pr_sec}s (±${pr_iqr_sec}s) | ${main_sec}s (±${main_iqr_sec}s) | ${diff_sec}s (${diff_pct}%) |"
echo "| ${label} | ${main_sec}s (±${main_iqr_sec}s) ${pr_sec}s (±${pr_iqr_sec}s) | ${diff_sec}s (${diff_pct}%) |"
}

BODY="## ⚡ Performance Benchmark

Packing the repomix repository with \`node bin/repomix.cjs\`

| Runner | PR | main | Diff |
|---|---:|---:|---:|
| Runner | main → PR | Diff |
|---|---:|---:|
$(generate_row "ubuntu-latest" "Ubuntu")
$(generate_row "macos-latest" "macOS")
$(generate_row "windows-latest" "Windows")
Expand Down
Loading