Skip to content

Commit d5b0359

Browse files
feat: fix publishing setup and add auto-update workflow
Changes: - Fix GitHub Actions permissions for changesets to create PRs - Add auto-update workflow for daily OpenAPI schema checks - Keep package name as @scope3/agentic-client - Publish to npm.org (public registry) with public access The auto-update workflow: - Runs daily at 2 AM UTC (can also be triggered manually) - Fetches latest OpenAPI schemas - Generates TypeScript types - Auto-commits, versions, and publishes if types change Fixes the "GitHub Actions is not permitted to create or approve pull requests" error by supporting PAT_TOKEN as fallback. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1827aef commit d5b0359

4 files changed

Lines changed: 97 additions & 12 deletions

File tree

‎.github/workflows/auto-update.yml‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Auto-update types from OpenAPI
2+
3+
on:
4+
schedule:
5+
# Run daily at 2 AM UTC
6+
- cron: '0 2 * * *'
7+
workflow_dispatch: # Allow manual trigger
8+
9+
jobs:
10+
update-and-publish:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20'
25+
registry-url: 'https://registry.npmjs.org'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Fetch latest OpenAPI schemas
31+
run: npm run update-schemas
32+
33+
- name: Check for changes
34+
id: git-check
35+
run: |
36+
git diff --exit-code src/types/ || echo "changed=true" >> $GITHUB_OUTPUT
37+
38+
- name: Commit and push if changed
39+
if: steps.git-check.outputs.changed == 'true'
40+
run: |
41+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
42+
git config --local user.name "github-actions[bot]"
43+
git add src/types/ openapi.yaml media-agent-openapi.yaml
44+
git commit -m "chore: update types from OpenAPI spec"
45+
git push
46+
47+
- name: Create changeset
48+
if: steps.git-check.outputs.changed == 'true'
49+
run: |
50+
cat << EOF > .changeset/auto-update-$(date +%s).md
51+
---
52+
"@scope3/agentic-client": patch
53+
---
54+
55+
Update types from latest OpenAPI specification
56+
EOF
57+
git add .changeset/
58+
git commit -m "chore: create changeset for type updates"
59+
git push
60+
61+
- name: Version packages
62+
if: steps.git-check.outputs.changed == 'true'
63+
run: |
64+
npx changeset version
65+
git add .
66+
git commit -m "chore: version packages"
67+
git push
68+
69+
- name: Build and publish
70+
if: steps.git-check.outputs.changed == 'true'
71+
run: npm run release
72+
env:
73+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
19+
token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
1920

2021
- name: Setup Node.js
2122
uses: actions/setup-node@v4
@@ -38,5 +39,5 @@ jobs:
3839
commit: 'chore: version packages'
3940
title: 'chore: version packages'
4041
env:
41-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
4243
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

‎package-lock.json‎

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"description": "TypeScript client for the Scope3 Agentic API with AdCP webhook support",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
7+
"publishConfig": {
8+
"access": "public"
9+
},
710
"bin": {
811
"simple-media-agent": "dist/simple-media-agent-server.js"
912
},
@@ -32,6 +35,14 @@
3235
],
3336
"author": "",
3437
"license": "MIT",
38+
"repository": {
39+
"type": "git",
40+
"url": "git+https://github.com/scope3data/agentic-client.git"
41+
},
42+
"bugs": {
43+
"url": "https://github.com/scope3data/agentic-client/issues"
44+
},
45+
"homepage": "https://github.com/scope3data/agentic-client#readme",
3546
"dependencies": {
3647
"@modelcontextprotocol/sdk": "^1.20.1",
3748
"express": "^4.18.0",

0 commit comments

Comments
 (0)