Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 48 additions & 10 deletions .github/workflows/openapi-diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,66 @@ on:
- .github/workflows/openapi-diff.yaml
workflow_dispatch:
inputs:
stable_version:
description: 'Stable Unleash version to compare against (e.g. unleash-server:6.9.3 or unleash-enterprise:6.10.0)'
required: false
default: 'unleash-server:latest'
baseline_version:
description: 'Stable Unleash version or commit SHA to compare against (e.g. v6.9.3, or a commit SHA).'
required: true

jobs:
generate-openapi-stable:
name: Generate OpenAPI (stable)
runs-on: ubuntu-latest
services:
postgres:
image: postgres
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The postgres service image should specify a version tag instead of using the implicit "latest" tag. Using "postgres" without a version tag can lead to unexpected behavior when the latest version changes. Consider pinning to a specific version like "postgres:15" or "postgres:16" to ensure consistent and reproducible builds.

Suggested change
image: postgres
image: postgres:16

Copilot uses AI. Check for mistakes.
env:
POSTGRES_PASSWORD: postgres
POSTGRES_INITDB_ARGS: "--no-sync"
ports:
- 5432:5432
options: >-
--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Determine baseline commit
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
git fetch origin "${{ github.event.pull_request.base.ref }}"
BASE_SHA=$(git merge-base "origin/${{ github.event.pull_request.base.ref }}" "${{ github.sha }}")
else
# workflow_dispatch: baseline_version is required
git fetch --tags origin
BASE_SHA=$(git rev-parse "${{ github.event.inputs.baseline_version }}")
fi
echo "BASE_SHA=$BASE_SHA" >> $GITHUB_ENV
- name: Checkout baseline commit
run: git checkout "${BASE_SHA}"
- name: Install node
uses: actions/setup-node@v6
with:
node-version: 22.x
- name: Install dependencies
run: |
yarn install --immutable
Comment on lines +48 to +55
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking out a commit SHA directly (line 48) puts the repository in a detached HEAD state. After this checkout, Node.js dependencies are installed (line 55), but the package.json and yarn.lock from the baseline commit might be incompatible with the later current branch state. This could cause the workflow to fail if there are dependency changes between the baseline and current branch.

Copilot uses AI. Check for mistakes.
- name: Start Unleash test instance
run: |
docker compose -f .github/docker-compose.test.yml up -d --wait -t 90
# fake frontend build
mkdir frontend/build
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the -p flag for mkdir. If the frontend/build directory already exists from a previous run or caching, the mkdir command will fail. Use "mkdir -p frontend/build" to ensure idempotent behavior.

Suggested change
mkdir frontend/build
mkdir -p frontend/build

Copilot uses AI. Check for mistakes.
touch frontend/build/index.html
touch frontend/build/favicon.ico
# end fake frontend build

# start unleash in background
NODE_ENV=openapi yarn dev:backend &
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow will fail if the backend doesn't start successfully. After starting the backend with "&", there's no check to ensure the process actually started. If the backend fails to start, the wait loop will timeout, but there's no cleanup or logging of the backend process output which would help debug failures.

Copilot uses AI. Check for mistakes.
env:
FRONTEND_TEST_LICENSE: ${{ secrets.FRONTEND_TEST_LICENSE }}
UNLEASH_VERSION: ${{ github.event.inputs.stable_version || 'unleash-server:main-edge' }}
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
DATABASE_SSL: 'false'
CHECK_VERSION: 'false'
- name: Wait for Unleash to be ready
run: |
for i in {1..30}; do
if curl -sf http://localhost:3000/health; then
if curl -sf http://localhost:4242/health; then
echo "Unleash is up!";
exit 0
fi
Expand All @@ -41,8 +79,8 @@ jobs:
done
echo "Unleash did not become ready in time."
exit 1
- name: Download OpenAPI spec from (${{ github.event.inputs.stable_version || 'tip of main' }})
run: curl -sSL -o openapi-stable.json "localhost:3000/docs/openapi.json"
- name: Download OpenAPI spec from baseline
run: curl -sSL -o openapi-stable.json "localhost:4242/docs/openapi.json"
- name: Upload openapi-stable.json
uses: actions/upload-artifact@v4
with:
Expand Down
Loading