← Back to Pull requests

Actions: Release PR workflow #9

Closed
unknown closed this pull request without merging on Nov 09, 2026 20:36 UTC
View on GitHub
unknown unknown commented on Nov 06, 2026 01:05 UTC
Author

Motivation

Centralize extension version handling and release preparation across the Python extension repositories. One read-only action returns the current version or calculates a previous/next version; a separate release action uses that same calculation to prepare a stable release branch.

Combining the getter and calculator removes an extra public action, wrapper, and nested-action hop without changing version rules. Release mutation remains a separate responsibility. These actions prepare versions and branches, not publication: existing Azure pipelines and approvals still build and publish releases.

Two actions

| Action | Responsibility | Output |
| --- | --- | --- |
| get-extension-version | Read or calculate a manifest-derived version without modifying the manifest. | One version, selected by mode. |
| release-pr | Classify a release PR, validate it, and optionally write, commit, and create its stable release branch. | Development version for plan; stable version for release; empty for ordinary PRs. |

Unified version action

| Input | Default | Allowed values / behavior |
| --- | --- | --- |
| package-json-path | package.json | Readable manifest path, absolute or relative to the caller's workspace; spaces are supported. |
| mode | current | current, previous, next. |
| type | Required in every mode | pre-release or release. |
| strategy | Required in every mode | odd-even-minor. |
| pre-release-suffix | Empty | SemVer prerelease identifiers such as dev or rc.1, without a leading - or build metadata. |

current returns the exact validated source version, including prerelease/build metadata. It requires valid type and strategy inputs but does not use them for calculation, and ignores the suffix. Reading imposes neither an odd/even minor policy nor Marketplace numeric bounds.

For previous and next, odd-even-minor selects the nearest strictly lower/higher minor with the requested parity: odd for pre-release, even for release. Move by two when the source minor already matches that parity, otherwise by one. Preserve major, reset patch to zero, and discard source prerelease/build metadata.

The supplied suffix applies only to calculated prerelease versions. Empty means no suffix; release versions are always suffix-free and ignore the suffix input.

Starting from 2026.9.7-dev+build:

| Mode | Type | Suffix | Result |
| --- | --- | --- | --- |
| current | Either valid type | Ignored | 2026.9.7-dev+build |
| next | pre-release | dev | 2026.11.0-dev |
| previous | pre-release | rc.1 | 2026.7.0-rc.1 |
| next | release | Empty | 2026.10.0 |
| previous | release | Empty | 2026.8.0 |

These are minor-selection rules, not SemVer patch increments. Missing files, invalid JSON/SemVer, unsupported options, invalid applicable suffixes, and calculated major/minor values outside 0..2147483647 fail. There is no calendar rollover, negative minor, or borrowing from major.

The version script uses argparse with named options, required inputs, allowed-value checks, and --help. YAML forwards inputs through quoted shell variables as CLI arguments rather than interpolating expressions into Bash source. Python does not read version configuration from environment variables; GITHUB_OUTPUT remains the standard output channel.

All Python code uses the standard library. The version action performs no checkout, Git operations, manifest writes, or publication; callers provide the manifest.

Release PR design

release-pr accepts required mode: plan | release and optional token, defaulting to github.token. Root package.json is its only manifest.

  • Plan: check out the exact PR head and compare against the recorded base. Only when root package.json is the sole changed file, export merge-base/head JSON snapshots and validate them. Only the top-level version may change; it must be a strictly greater SemVer with a positive odd minor. Formatting/key order are ignored, while nested values, array order, boolean/number distinctions, and exact numeric values are preserved.

  • Shared calculation: call get-extension-version on the validated source snapshot with mode: previous, type: release, and strategy: odd-even-minor. Both modes derive the stable target, but plan returns the submitted development version. Larger valid development-version jumps remain accepted.

  • Release: after merge, check out the exact merged commit and repeat validation against the recorded base, covering the entire merged change including multi-commit rebases. Revalidate snapshots, serialize the stable manifest without changing other JSON values, commit, and push to release/<stable-version>.
  • Classification is deliberately narrow: mixed-file PRs skip successfully even when they bump the version; single-manifest PRs with unchanged versions also skip. Sole-manifest additions, deletions, symlinks, and file-mode changes fail. Python Environments' api/package.json retains its independent npm release flow.

    Git stays in short YAML commands; Python never invokes Git or GitHub APIs. Serialization uses four-space indentation and a final newline. An empty force-with-lease prevents overwriting an existing differing release ref. The target branch is never pushed, checked-out PR scripts are not executed, and commit hooks are disabled.

    The internal $/ reference composes release-pr -> get-extension-version at the same repository/ref as the outer action, including SHA-pinned consumers. This composition requires GitHub.com and runner 2.336.0 or newer; GitHub Enterprise Server is not supported for self-repository references.

    Usage

    Read or calculate a version

    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - id: current
        uses: microsoft/vscode-python-ci/actions/get-extension-version@<reviewed-commit-sha>
        with:
          type: pre-release
          strategy: odd-even-minor
      - id: next
        uses: microsoft/vscode-python-ci/actions/get-extension-version@<reviewed-commit-sha>
        with:
          mode: next
          type: pre-release
          strategy: odd-even-minor
          pre-release-suffix: dev
      - id: previous
        uses: microsoft/vscode-python-ci/actions/get-extension-version@<reviewed-commit-sha>
        with:
          mode: previous
          type: release
          strategy: odd-even-minor
    

    Read ${{ steps.current.outputs.version }}, ${{ steps.next.outputs.version }}, or ${{ steps.previous.outputs.version }} in later steps. Each invocation is independent; no separate getter step is needed for a calculation. Supply package-json-path for another manifest or temporary snapshot.

    Equivalent CLI usage:

    python actions/get-extension-version/scripts/extension_version.py \
      --package-json-path="path with spaces/package.json" \
      --mode=previous --type=release --strategy=odd-even-minor
    

    Release workflow

    name: Release PR
    
    on:
      pull_request:
        branches: [main]
        types: [opened, reopened, synchronize, edited]
      pull_request_target:
        branches: [main]
        types: [closed]
    
    permissions:
      contents: read
    
    jobs:
      plan:
        name: Release PR / Plan
        if: github.event_name == 'pull_request'
        runs-on: ubuntu-latest
        steps:
          - uses: microsoft/vscode-python-ci/actions/release-pr@<reviewed-commit-sha>
            with:
              mode: plan
    
      release:
        name: Release PR / Release
        if: github.event_name == 'pull_request_target' && github.event.pull_request.merged == true
        runs-on: ubuntu-latest
        permissions:
          contents: write
        steps:
          - uses: microsoft/vscode-python-ci/actions/release-pr@<reviewed-commit-sha>
            with:
              mode: release
    

    Use the same reviewed SHA in both jobs. release-pr performs checkout itself, so use dedicated jobs. Configure Release PR / Plan as a required check on the current revision and allow the bot to create release/.

    The closed pull_request_target event supports write tokens for merged fork PRs using the trusted target-branch workflow. Do not add steps that execute checked-out PR code.

    Consumers' Azure pipelines must already trigger on release/ and enable publishing in the merged source. A default GitHub token normally suppresses subsequent GitHub Actions push workflows; Azure is a separate integration. Consumer rollout and pipeline configuration are outside this PR.

    Validation

    All 15 focused tests pass locally at 2172390f474c95abea20907def2e0f292d0c4322: seven version-action tests and eight release-action tests. Coverage includes CLI defaults/custom paths, required inputs and allowed values, read-only outputs, both directions/parities, suffixes and numeric boundaries, version-only JSON changes, upgrade rules, ordinary PRs, lossless serialization, merged-source preservation, whole-change gating after a rebase, file-mode rejection, and no-overwrite pushes. Git fixtures execute the actual YAML commands against temporary local bare remotes.

    CI runs both suites on Linux, Windows, and macOS. It also includes a no-checkout smoke test for all three version modes and a read-only release-plan smoke test on this repository's PRs.

    Remaining integration coverage: ordinary engineering PRs do not qualify as version-only release candidates, so the release-plan smoke does not exercise the full candidate path. A qualifying read-only consumer PR would verify that path and external SHA-pinned composition before rollout. Hosted CI results were not reverified as part of this description update.

    No production release or Azure publication was triggered during local validation.

    Documentation: get-extension-version and release-pr.

    Diff: 650 lines (+487 / -163) across 8 files Reviewer: edvilme Review duration: 5491m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #9"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.5% · Safe to merge
    22.5%