commit f46d832f51c6f3b0fda9a7e1afa62bd47ff46488
parent 70b41e89a396e99a2c049507f7c570d1a2dee327
Author: andrewlaack-collab <andrew.laack@imbue.com>
Date: Fri, 13 Feb 2026 19:22:34 +0000
Improved base sha calculation (#83)
Resolves issue where divergences could result in weird results for running vet.
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/vet.yml b/.github/workflows/vet.yml
@@ -15,6 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
+ ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/setup-python@v5
with:
@@ -27,6 +28,7 @@ jobs:
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ BASE_REF: ${{ github.event.pull_request.base.ref }}
VET_GOAL: |
${{ github.event.pull_request.title }}
@@ -34,8 +36,9 @@ jobs:
${{ github.event.pull_request.body }}
run: |
set +e
+ MERGE_BASE=$(git merge-base "origin/$BASE_REF" "${{ github.event.pull_request.head.sha }}")
vet "$VET_GOAL" --quiet --output-format github \
- --base-commit "${{ github.event.pull_request.base.sha }}" \
+ --base-commit "$MERGE_BASE" \
> "$RUNNER_TEMP/review.json"
status=$?
if [ "$status" -ne 0 ] && [ "$status" -ne 10 ]; then exit "$status"; fi
diff --git a/README.md b/README.md
@@ -103,6 +103,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
+ ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: actions/setup-python@v5
with:
@@ -113,6 +114,7 @@ jobs:
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ BASE_REF: ${{ github.event.pull_request.base.ref }}
VET_GOAL: |
${{ github.event.pull_request.title }}
@@ -120,8 +122,9 @@ jobs:
${{ github.event.pull_request.body }}
run: |
set +e
+ MERGE_BASE=$(git merge-base "origin/$BASE_REF" "${{ github.event.pull_request.head.sha }}")
vet "$VET_GOAL" --quiet --output-format github \
- --base-commit "${{ github.event.pull_request.base.sha }}" \
+ --base-commit "$MERGE_BASE" \
> "$RUNNER_TEMP/review.json"
status=$?
if [ "$status" -ne 0 ] && [ "$status" -ne 10 ]; then exit "$status"; fi