diff --git a/.github/workflows/generate-command.yml b/.github/workflows/generate-command.yml index d3df4568..8cb41600 100644 --- a/.github/workflows/generate-command.yml +++ b/.github/workflows/generate-command.yml @@ -67,8 +67,36 @@ concurrency: cancel-in-progress: true jobs: + check-paths: + name: Check Generation Paths + if: ${{ inputs.dry_run }} + runs-on: ubuntu-latest + outputs: + should_run: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.generation == 'true' }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Filter changed paths + uses: dorny/paths-filter@v4 + id: filter + with: + filters: | + generation: + - '.speakeasy/**' + - '.genignore' + - '.github/speakeasy/**' + - '.github/workflows/generate-command.yml' + - 'gen.yaml' + - 'overlays/**' + - 'README.md' + - 'scripts/**' + - 'poe_tasks.toml' + - 'src/**' + generate: name: Generate SDK + needs: [check-paths] + if: ${{ always() && (!inputs.dry_run || needs.check-paths.outputs.should_run == 'true') }} runs-on: ubuntu-latest timeout-minutes: 30 outputs: diff --git a/.github/workflows/test-full.yml b/.github/workflows/test-full.yml index 70ebf42e..a5867018 100644 --- a/.github/workflows/test-full.yml +++ b/.github/workflows/test-full.yml @@ -4,17 +4,14 @@ # and that the committed generated code matches what the generation pipeline produces. # # Jobs: -# 1. validate: Runs the full generation pipeline in dry-run mode +# 1. validate: Calls generate-command.yml with dry_run=true. The generation +# workflow handles its own path filtering — it skips the Generate SDK job +# when only non-generation files changed (e.g., dev dependency bumps). # 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) @@ -27,28 +24,8 @@ permissions: 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 @@ -56,8 +33,8 @@ jobs: 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' + needs: [validate] + if: github.event_name == 'pull_request' runs-on: ubuntu-latest permissions: contents: read