Skip to content

ci: bump astral-sh/setup-uv from 5 to 7 #90

ci: bump astral-sh/setup-uv from 5 to 7

ci: bump astral-sh/setup-uv from 5 to 7 #90

Workflow file for this run

# Validate Speakeasy Generation (Dry Run) + Zero-Diff Check
#
# This workflow validates that Speakeasy generation can complete successfully
# and that the committed generated code matches what the generation pipeline produces.
#
# Jobs:
# 1. validate: Runs the full generation pipeline in dry-run mode
# 2. zero-diff: Checks for drift using the validate job's outputs (in-place git status).
# If drift is detected, the check fails and posts a comment telling the author to run /generate.
#
# This workflow calls the main generation workflow with dry_run=true to ensure
# both workflows use the same generation logic.
#
# Note: paths-ignore is NOT used at the workflow level because GitHub treats a
# workflow that never runs as "expected" (pending), which blocks required checks.
# Instead, we filter paths at the job level so skipped jobs report as "skipped"
# (equivalent to "passed" for required checks).
name: Test (Full)
on:
pull_request:
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
check-paths:
name: Check Changed Paths
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Filter changed paths
uses: dorny/paths-filter@v4
id: filter
with:
filters: |
generation:
- '**'
- '!README.md'
- '!docs/**'
outputs:
should_run: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.generation == 'true' }}
validate:
name: Validate Generation (Dry Run)
needs: check-paths
if: needs.check-paths.outputs.should_run == 'true'
uses: ./.github/workflows/generate-command.yml
with:
dry_run: true
secrets: inherit
zero-diff:
name: Zero-Diff Check (Generated Code)
needs: [check-paths, validate]
if: needs.check-paths.outputs.should_run == 'true' && github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check for generation drift
id: drift-check
run: |
if [ "${{ needs.validate.outputs.has_changes }}" = "true" ]; then
echo "has_diff=true" >> $GITHUB_OUTPUT
echo "::warning::Generated code drift detected. The committed code does not match what the generation pipeline produces."
else
echo "has_diff=false" >> $GITHUB_OUTPUT
echo "Zero-diff check passed. Committed code matches generation output."
fi
- name: Find existing drift comment
if: steps.drift-check.outputs.has_diff == 'true'
uses: peter-evans/find-comment@v3
id: find-drift-comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: '<!-- zero-diff-check -->'
- name: Post drift comment on PR
if: steps.drift-check.outputs.has_diff == 'true'
uses: peter-evans/create-or-update-comment@v5
with:
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-drift-comment.outputs.comment-id || '' }}
edit-mode: replace
body: |
<!-- zero-diff-check -->
**Generated Code Drift Detected**
The committed code does not match what the generation pipeline produces.
**To fix:** Comment `/generate` on this PR to regenerate.
```
${{ needs.validate.outputs.drift_summary }}
```
- name: Fail if drift detected
if: steps.drift-check.outputs.has_diff == 'true'
run: |
echo "::error::Generated code drift detected. Run /generate on this PR to fix."
exit 1