fix(video3d): ignore slower first library confirm #489
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR Review | |
| # Heuristic review posted on every PR. No LLM and no Cursor usage-based | |
| # billing — this is the in-repo stand-in for a Cursor Automation / Bugbot | |
| # pass when those require a payment method. | |
| # | |
| # Actions are pinned to commit SHAs. Do not use moving tags such as @v4 or @latest. | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| branches: [main, development, dev] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| review: | |
| name: Analyze pull request | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| # Scripts come from the PR base (or the dispatched SHA). The head is | |
| # fetched only as diff input so a PR cannot rewrite analyze_pr.py while | |
| # this job holds pull-requests:write. | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| ref: ${{ github.event.pull_request.base.sha || github.sha }} | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0 | |
| with: | |
| python-version: "3.10" | |
| - name: Build diff and review | |
| env: | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| if [ -n "${BASE_SHA:-}" ] && [ -n "${PR_NUMBER:-}" ]; then | |
| # refs/pull/*/head exists on the base repo for same-repo and fork | |
| # PRs. GitHub git-over-HTTPS wants basic x-access-token, not Bearer. | |
| # The header is one-shot via git -c; credentials are not persisted. | |
| AUTH="$(python3 -c "import base64, os; print(base64.b64encode(b'x-access-token:' + os.environ['GH_TOKEN'].encode()).decode())")" | |
| git -c "http.https://github.com/.extraheader=AUTHORIZATION: basic ${AUTH}" \ | |
| fetch --no-tags origin "pull/${PR_NUMBER}/head:refs/remotes/origin/pr-head" | |
| git diff --no-color --find-renames "${BASE_SHA}...origin/pr-head" > /tmp/pr.diff | |
| else | |
| git diff --no-color --find-renames "origin/${GITHUB_REF_NAME:-main}...HEAD" > /tmp/pr.diff || \ | |
| git diff --no-color --find-renames HEAD > /tmp/pr.diff | |
| fi | |
| python scripts/analyze_pr.py --diff /tmp/pr.diff --out /tmp/review.md | |
| python -m unittest tests/test_analyze_pr.py | |
| - name: Post or update review comment | |
| if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| set -euo pipefail | |
| marker='<!-- loreframe-pr-review -->' | |
| existing="$(gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \ | |
| --jq ".[] | select(.body | contains(\"${marker}\")) | .id" | head -n 1 || true)" | |
| if [ -n "${existing}" ]; then | |
| gh api --method PATCH "repos/${GITHUB_REPOSITORY}/issues/comments/${existing}" \ | |
| -F body=@/tmp/review.md | |
| else | |
| gh api --method POST "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \ | |
| -F body=@/tmp/review.md | |
| fi |