Skip to content
Closed
Show file tree
Hide file tree
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
32 changes: 0 additions & 32 deletions .github/workflows/build-and-copy-pms-spec.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/build-and-push-pms-spec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build and Push Plex Media Server API Spec

permissions:
checks: write
contents: write
pull-requests: write
statuses: write
Comment on lines +3 to +7
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@LukeHagar And by extension this as well?


on:
workflow_dispatch:
inputs:
force:
description: Force generation of SDKs
type: boolean
default: false
Comment on lines +11 to +15
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@LukeHagar Can this be removed as well?

push:
Comment on lines +9 to +16
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Consider adding a pull_request trigger
It may prove advantageous to execute this workflow against pull requests as well, ensuring spec changes are validated before merging. For example:

on:
  pull_request:
    branches:
      - main
    paths:
      - .github/workflows/build-and-push-pms-spec.yml
      - src/**
🤖 Prompt for AI Agents
In .github/workflows/build-and-push-pms-spec.yml around lines 9 to 16, the
workflow triggers only on workflow_dispatch and push events. Add a pull_request
trigger targeting the main branch and relevant paths like
.github/workflows/build-and-push-pms-spec.yml and src/** to ensure the workflow
runs on pull requests, validating spec changes before merging. Update the on
section to include this pull_request trigger alongside the existing triggers.

branches:
- main
paths:
- .github/workflows/build-and-push-pms-spec.yaml
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Errant file extension in push trigger paths
Might I point out that the paths filter references build-and-push-pms-spec.yaml while our file is named build-and-push-pms-spec.yml. This mismatch will prevent the workflow from firing on pushes.

-      - .github/workflows/build-and-push-pms-spec.yaml
+      - .github/workflows/build-and-push-pms-spec.yml
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- .github/workflows/build-and-push-pms-spec.yaml
- .github/workflows/build-and-push-pms-spec.yml
🤖 Prompt for AI Agents
In .github/workflows/build-and-push-pms-spec.yml at line 20, the paths filter
incorrectly references the file with a .yaml extension instead of .yml. Update
the path from build-and-push-pms-spec.yaml to build-and-push-pms-spec.yml to
match the actual filename and ensure the workflow triggers correctly on pushes.

- src/**

jobs:
build:
name: Build Open API Spec
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Project Setup
uses: ./.github/workflows/steps/project-setup

- name: Build Plex Media Server Specification
run: bun run build

- name: Commit Build Specification Files
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "build: dereferenced Plex Media Server API Spec updated"
skip_checkout: true
skip_fetch: true
add_options: "-f"
file_pattern: "./output/*.yaml"
skip_dirty_check: true
generate:
needs: build
name: Push to Speakeasy API
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
with:
force: ${{ github.event.inputs.force }}
Comment on lines +49 to +50
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@LukeHagar Can this be removed if this pipeline will never generate an SDK directly?

mode: direct
speakeasy_version: latest
secrets:
Comment on lines +49 to +53
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Pin Speakeasy version for stability
Using latest may introduce untested changes. Might I suggest pinning to a known good version?

# Instead of:
speakeasy_version: latest
# consider:
speakeasy_version: vX.Y.Z  # pin to tested release
🤖 Prompt for AI Agents
In .github/workflows/build-and-push-pms-spec.yml around lines 49 to 53, the
speakeasy_version is set to 'latest', which can cause instability due to
untested changes. Replace 'latest' with a specific, tested version tag like
'vX.Y.Z' to pin the dependency to a known good release for stability.

github_access_token: ${{ secrets.GITHUB_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
31 changes: 0 additions & 31 deletions .github/workflows/sdk_generation.yaml

This file was deleted.

Binary file modified bun.lockb
Binary file not shown.
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
"dev": "redocly preview -d=./src",
"preview-docs": "redocly preview-docs src/pms-spec.yaml --config=./redocly.yaml",
"stats": "redocly stats ./src/pms-spec.yaml",
"build": "swagger-cli bundle --dereference ./src/pms-spec.yaml -t yaml -o ./output/plex-media-server-spec-dereferenced.yaml",
"build": "bun run build-referenced & bun run build-dereferenced & wait",
"build-referenced": "redocly bundle ./src/pms-spec.yaml --config ./redocly.yaml --ext yaml -o ./output/plex-media-server-spec-referenced.yaml",
"build-dereferenced": "swagger-cli bundle --dereference ./src/pms-spec.yaml -t yaml -o ./output/plex-media-server-spec-dereferenced.yaml",
"build-watch": "bun run build && chokidar './src/**/*' -c 'bun run build'",
Comment on lines +20 to 23
Copy link
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick (assertive)

Cross-platform compatibility of build scripts
The use of shell backgrounding (&) and wait may not behave uniformly on Windows. Perhaps we could employ a cross-platform utility, e.g., concurrently:

- "build": "bun run build-referenced & bun run build-dereferenced & wait",
+ "build": "npx concurrently \"bun run build-referenced\" \"bun run build-dereferenced\""
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"build": "bun run build-referenced & bun run build-dereferenced & wait",
"build-referenced": "redocly bundle ./src/pms-spec.yaml --config ./redocly.yaml --ext yaml -o ./output/plex-media-server-spec-referenced.yaml",
"build-dereferenced": "swagger-cli bundle --dereference ./src/pms-spec.yaml -t yaml -o ./output/plex-media-server-spec-dereferenced.yaml",
"build-watch": "bun run build && chokidar './src/**/*' -c 'bun run build'",
"build": "npx concurrently \"bun run build-referenced\" \"bun run build-dereferenced\"",
"build-referenced": "redocly bundle ./src/pms-spec.yaml --config ./redocly.yaml --ext yaml -o ./output/plex-media-server-spec-referenced.yaml",
"build-dereferenced": "swagger-cli bundle --dereference ./src/pms-spec.yaml -t yaml -o ./output/plex-media-server-spec-dereferenced.yaml",
"build-watch": "bun run build && chokidar './src/**/*' -c 'bun run build'",
🤖 Prompt for AI Agents
In package.json lines 20 to 23, the build script uses shell backgrounding with
'&' and 'wait', which is not cross-platform compatible, especially on Windows.
Replace this approach by installing and using a cross-platform utility like
'concurrently' to run 'build-referenced' and 'build-dereferenced' scripts in
parallel. Update the "build" script to use 'concurrently' with the two commands
as arguments, ensuring it works consistently across different operating systems.

"build-redocly": "redocly bundle ./src/pms-spec.yaml --ext yaml -o ./output/plex-media-server-spec-dereferenced.yaml",
"test": "bun run build && vitest --run",
"type-check": "tsc",
"setup-speakeasy-cli": "curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh",
Expand All @@ -29,9 +30,9 @@
"lint-bundled": "speakeasy lint openapi -s ./output/plex-media-server-spec-dereferenced.yaml"
},
"devDependencies": {
"@modyfi/vite-plugin-yaml": "^1.1.0",
"@modyfi/vite-plugin-yaml": "^1.1.1",
"@ngneat/falso": "^7.3.0",
"@redocly/cli": "^1.28.1",
"@redocly/cli": "^1.34.3",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.5.0",
"chokidar-cli": "^3.0.0",
Expand Down