From 2c5eca28734974999df89dca86023e317c5fac09 Mon Sep 17 00:00:00 2001 From: Nastassia Fulconis Date: Thu, 6 Nov 2025 08:03:37 -0800 Subject: [PATCH 1/2] chore: update OpenAPI workflows and fix npm publishing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update auto-update workflow to fetch from agentic-api repo - Switch from media-agent to outcome-agent OpenAPI spec - Add partner-api and platform-api specs - Configure workflow to create PRs instead of direct push - Fix release workflow to use Trusted Publishing with OIDC - Remove NPM_TOKEN dependencies in favor of Trusted Publishing 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .github/workflows/auto-update.yml | 49 +++++++++++++++++++------------ .github/workflows/release.yml | 4 ++- package.json | 7 +++-- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index 5e709c9..79c3be2 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -11,6 +11,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + pull-requests: write steps: - name: Checkout code @@ -33,20 +34,24 @@ jobs: - name: Check for changes id: git-check run: | - git diff --exit-code src/types/ || echo "changed=true" >> $GITHUB_OUTPUT + git diff --exit-code src/types/ outcome-agent-openapi.yaml partner-api.yaml platform-api.yaml || echo "changed=true" >> $GITHUB_OUTPUT - - name: Commit and push if changed + - name: Create Pull Request if: steps.git-check.outputs.changed == 'true' run: | + # Configure git git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" - git add src/types/ openapi.yaml media-agent-openapi.yaml + + # Create a new branch + BRANCH_NAME="auto-update-openapi-$(date +%s)" + git checkout -b $BRANCH_NAME + + # Commit type changes + git add src/types/ outcome-agent-openapi.yaml partner-api.yaml platform-api.yaml git commit -m "chore: update types from OpenAPI spec" - git push - - name: Create changeset - if: steps.git-check.outputs.changed == 'true' - run: | + # Create changeset cat << EOF > .changeset/auto-update-$(date +%s).md --- "@scope3/agentic-client": patch @@ -56,18 +61,24 @@ jobs: EOF git add .changeset/ git commit -m "chore: create changeset for type updates" - git push - - name: Version packages - if: steps.git-check.outputs.changed == 'true' - run: | - npx changeset version - git add . - git commit -m "chore: version packages" - git push + # Push branch + git push -u origin $BRANCH_NAME - - name: Build and publish - if: steps.git-check.outputs.changed == 'true' - run: npm run release + # Create PR using GitHub CLI + gh pr create \ + --title "chore: auto-update types from OpenAPI spec" \ + --body "This PR was automatically generated by the auto-update workflow. + + ## Changes + - Updated types from latest OpenAPI specifications from [agentic-api repo](https://github.com/scope3data/agentic-api/tree/main/mintlify) + - Outcome Agent API (replacing Media Agent) + - Partner API + - Platform API + - Created changeset for patch version bump + + The types will be published once this PR is merged and the release workflow runs." \ + --base main \ + --head $BRANCH_NAME env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88a5cc0..e9955be 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,6 +11,9 @@ jobs: release: name: Release runs-on: ubuntu-latest + permissions: + contents: read + id-token: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -40,4 +43,3 @@ jobs: title: 'chore: version packages' env: GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/package.json b/package.json index 1c0e6a3..309970c 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,10 @@ "lint": "eslint src --ext .ts", "format": "prettier --write \"src/**/*.ts\"", "type-check": "tsc --noEmit", - "generate-types": "openapi-typescript openapi.yaml -o src/types/api.ts", - "generate-media-agent-types": "openapi-typescript media-agent-openapi.yaml -o src/types/media-agent-api.ts", - "update-schemas": "curl -f -o openapi.yaml https://docs.agentic.scope3.com/openapi.yaml && curl -f -o media-agent-openapi.yaml https://docs.agentic.scope3.com/media-agent-openapi.yaml && npm run generate-types && npm run generate-media-agent-types", + "generate-outcome-agent-types": "openapi-typescript outcome-agent-openapi.yaml -o src/types/outcome-agent-api.ts", + "generate-partner-api-types": "openapi-typescript partner-api.yaml -o src/types/partner-api.ts", + "generate-platform-api-types": "openapi-typescript platform-api.yaml -o src/types/platform-api.ts", + "update-schemas": "curl -f -o outcome-agent-openapi.yaml https://raw.githubusercontent.com/scope3data/agentic-api/main/mintlify/outcome-agent-openapi.yaml && curl -f -o partner-api.yaml https://raw.githubusercontent.com/scope3data/agentic-api/main/mintlify/partner-api.yaml && curl -f -o platform-api.yaml https://raw.githubusercontent.com/scope3data/agentic-api/main/mintlify/platform-api.yaml && npm run generate-outcome-agent-types && npm run generate-partner-api-types && npm run generate-platform-api-types", "prepare": "husky", "pretest": "npm run type-check", "changeset": "changeset", From 1fe1262a41090672fbab9267ab5d60a21c4b4b7e Mon Sep 17 00:00:00 2001 From: Nastassia Fulconis Date: Thu, 6 Nov 2025 08:10:20 -0800 Subject: [PATCH 2/2] chore: add changeset for OpenAPI workflow updates --- .changeset/openapi-workflow-fixes.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/openapi-workflow-fixes.md diff --git a/.changeset/openapi-workflow-fixes.md b/.changeset/openapi-workflow-fixes.md new file mode 100644 index 0000000..b733479 --- /dev/null +++ b/.changeset/openapi-workflow-fixes.md @@ -0,0 +1,5 @@ +--- +"@scope3/agentic-client": patch +--- + +Update OpenAPI auto-update workflow to create PRs and fetch from agentic-api repo. Configure release workflow for npm Trusted Publishing with OIDC.