From 4837e8f3581f254b8fe701211b8a869a8460cf2d Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 3 Mar 2026 12:39:00 +0000 Subject: [PATCH 01/13] Try to set up pkg.pr.new --- .github/workflows/continuous-release.yml | 147 ++++++ package-lock.json | 592 ++++++++++++++++++++++- package.json | 1 + 3 files changed, 737 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/continuous-release.yml diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml new file mode 100644 index 0000000000..c8ea3651cb --- /dev/null +++ b/.github/workflows/continuous-release.yml @@ -0,0 +1,147 @@ +name: Publish approved pull requests and latest commit to pkg.pr.new +on: + pull_request: + types: + - opened + branches: + - 'dev-2.0' + push: + branches: + - 'dev-2.0' + tags: + - '!**' + +permissions: {} + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install dependencies + run: npm ci + + - name: Build library + run: npm run build + + - name: Publish library + run: npx pkg-pr-new publish --no-template --json output.json --comment=off + + - name: Post or update comment + uses: actions/github-script@v8 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require('fs'); + const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); + + const packages = output.packages + .map((p) => `- ${p.name}: ${p.url}`) + .join('\n'); + + const cdnLinks = output.packages + .map((p) => `- ${p.name}: ${p.url.replace('pkg.pr.new', 'raw.esm.sh/pr')}/lib/p5.min.js`) + .join('\n'); + + const sha = + context.event_name === 'pull_request' + ? context.payload.pull_request.head.sha + : context.payload.after; + + const commitUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${sha}`; + + const body = `## Continuous Release + + ### CDN link + + ${cdnLinks} + + ### Published Packages: + + ${packages} + + [View Commit](${commitUrl}) + + --- + + _This is an automated message._`; + + const botCommentIdentifier = '## Continuous Release'; + + async function findBotComment(issueNumber) { + if (!issueNumber) return null; + const comments = await github.rest.issues.listComments({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issueNumber, + }); + return comments.data.find((comment) => + comment.body.includes(botCommentIdentifier) + ); + } + + async function createOrUpdateComment(issueNumber) { + if (!issueNumber) { + console.log('No issue number provided. Cannot post or update comment.'); + return; + } + + const existingComment = await findBotComment(issueNumber); + if (existingComment) { + await github.rest.issues.updateComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: existingComment.id, + body: body, + }); + } else { + await github.rest.issues.createComment({ + issue_number: issueNumber, + owner: context.repo.owner, + repo: context.repo.repo, + body: body, + }); + } + } + + async function logPublishInfo() { + console.log('\n' + '='.repeat(50)); + console.log('Publish Information'); + console.log('='.repeat(50)); + console.log('\nPublished Packages:'); + console.log(packages); + console.log('\nTemplates:'); + console.log(templates); + console.log(`\nCommit URL: ${commitUrl}`); + console.log('\n' + '='.repeat(50)); + } + + if (context.eventName === 'pull_request') { + if (context.issue.number) { + await createOrUpdateComment(context.issue.number); + } + } else if (context.eventName === 'push') { + const pullRequests = await github.rest.pulls.list({ + owner: context.repo.owner, + repo: context.repo.repo, + state: 'open', + head: `${context.repo.owner}:${context.ref.replace( + 'refs/heads/', + '' + )}`, + }); + + if (pullRequests.data.length > 0) { + await createOrUpdateComment(pullRequests.data[0].number); + } else { + console.log( + 'No open pull request found for this push. Logging publish information to console:' + ); + await logPublishInfo(); + } + } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 4334dbb370..3012154463 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,6 +46,7 @@ "lint-staged": "^15.1.0", "msw": "^2.6.3", "pixelmatch": "^7.1.0", + "pkg-pr-new": "^0.0.65", "rollup": "^4.9.6", "rollup-plugin-string": "^3.0.0", "rollup-plugin-visualizer": "^5.12.0", @@ -56,6 +57,45 @@ "webdriverio": "^9.0.7" } }, + "node_modules/@actions/core": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.0.tgz", + "integrity": "sha512-zYt6cz+ivnTmiT/ksRVriMBOiuoUpDCJJlZ5KPl2/FRdvwU3f7MPh9qftvbkXJThragzUZieit2nyHUyw53Seg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/exec": "^3.0.0", + "@actions/http-client": "^4.0.0" + } + }, + "node_modules/@actions/exec": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-3.0.0.tgz", + "integrity": "sha512-6xH/puSoNBXb72VPlZVm7vQ+svQpFyA96qdDBvhB8eNZOE8LtPf9L4oAsfzK/crCL8YZ+19fKYVnM63Sl+Xzlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/io": "^3.0.2" + } + }, + "node_modules/@actions/http-client": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz", + "integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "tunnel": "^0.0.6", + "undici": "^6.23.0" + } + }, + "node_modules/@actions/io": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@actions/io/-/io-3.0.2.tgz", + "integrity": "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw==", + "dev": true, + "license": "MIT" + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", @@ -2273,6 +2313,22 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@jsdevtools/ez-spawn": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@jsdevtools/ez-spawn/-/ez-spawn-3.0.4.tgz", + "integrity": "sha512-f5DRIOZf7wxogefH03RjMPMdBF7ADTWUMoOs9kaJo06EfwF+aFhMZMDZxHg/Xe12hptN9xoZjGso2fdjapBRIA==", + "dev": true, + "license": "MIT", + "dependencies": { + "call-me-maybe": "^1.0.1", + "cross-spawn": "^7.0.3", + "string-argv": "^0.3.1", + "type-detect": "^4.0.8" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@mswjs/interceptors": { "version": "0.37.6", "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.37.6.tgz", @@ -2329,6 +2385,278 @@ "node": ">= 8" } }, + "node_modules/@octokit/action": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/@octokit/action/-/action-6.1.0.tgz", + "integrity": "sha512-lo+nHx8kAV86bxvOVOI3vFjX3gXPd/L7guAUbvs3pUvnR2KC+R7yjBkA1uACt4gYhs4LcWP3AXSGQzsbeN2XXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-action": "^4.0.0", + "@octokit/core": "^5.0.0", + "@octokit/plugin-paginate-rest": "^9.0.0", + "@octokit/plugin-rest-endpoint-methods": "^10.0.0", + "@octokit/types": "^12.0.0", + "undici": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/auth-action": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-action/-/auth-action-4.1.0.tgz", + "integrity": "sha512-m+3t7K46IYyMk7Bl6/lF4Rv09GqDZjYmNg8IWycJ2Fa3YE3DE7vQcV6G2hUPmR9NDqenefNJwVtlisMjzymPiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/types": "^13.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/auth-action/node_modules/@octokit/openapi-types": { + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/auth-action/node_modules/@octokit/types": { + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^24.2.0" + } + }, + "node_modules/@octokit/auth-token": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", + "integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.2.tgz", + "integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/auth-token": "^4.0.0", + "@octokit/graphql": "^7.1.0", + "@octokit/request": "^8.4.1", + "@octokit/request-error": "^5.1.1", + "@octokit/types": "^13.0.0", + "before-after-hook": "^2.2.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/core/node_modules/@octokit/openapi-types": { + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/core/node_modules/@octokit/types": { + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^24.2.0" + } + }, + "node_modules/@octokit/endpoint": { + "version": "9.0.6", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz", + "integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/endpoint/node_modules/@octokit/openapi-types": { + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/endpoint/node_modules/@octokit/types": { + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^24.2.0" + } + }, + "node_modules/@octokit/graphql": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.1.1.tgz", + "integrity": "sha512-3mkDltSfcDUoa176nlGoA32RGjeWjl3K7F/BwHwRMJUW/IteSa4bnSV8p2ThNkcIcZU2umkZWxwETSSCJf2Q7g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/request": "^8.4.1", + "@octokit/types": "^13.0.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/graphql/node_modules/@octokit/openapi-types": { + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/graphql/node_modules/@octokit/types": { + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^24.2.0" + } + }, + "node_modules/@octokit/openapi-types": { + "version": "20.0.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz", + "integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/plugin-paginate-rest": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.2.tgz", + "integrity": "sha512-u3KYkGF7GcZnSD/3UP0S7K5XUFT2FkOQdcfXZGZQPGv3lm4F2Xbf71lvjldr8c1H3nNbF+33cLEkWYbokGWqiQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/plugin-rest-endpoint-methods": { + "version": "10.4.1", + "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz", + "integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^12.6.0" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "@octokit/core": "5" + } + }, + "node_modules/@octokit/request": { + "version": "8.4.1", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz", + "integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/endpoint": "^9.0.6", + "@octokit/request-error": "^5.1.1", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz", + "integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": { + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/request-error/node_modules/@octokit/types": { + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^24.2.0" + } + }, + "node_modules/@octokit/request/node_modules/@octokit/openapi-types": { + "version": "24.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz", + "integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@octokit/request/node_modules/@octokit/types": { + "version": "13.10.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz", + "integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^24.2.0" + } + }, + "node_modules/@octokit/types": { + "version": "12.6.0", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz", + "integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@octokit/openapi-types": "^20.0.0" + } + }, "node_modules/@open-draft/deferred-promise": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz", @@ -4333,6 +4661,13 @@ "node": ">=10.0.0" } }, + "node_modules/before-after-hook": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", + "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==", + "dev": true, + "license": "Apache-2.0" + }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", @@ -4452,6 +4787,13 @@ "dev": true, "license": "MIT" }, + "node_modules/call-me-maybe": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.2.tgz", + "integrity": "sha512-HpX65o1Hnr9HH25ojC1YGs7HCQLq0GCOibSaWER0eNpgJ/Z1MZv2mTc7+xh6WOPxbRVcmgbv4hGU+uSQ/2xFZQ==", + "dev": true, + "license": "MIT" + }, "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", @@ -4949,6 +5291,13 @@ "node": ">=12" } }, + "node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "dev": true, + "license": "MIT" + }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -5165,6 +5514,16 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/decode-uri-component": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.4.1.tgz", + "integrity": "sha512-+8VxcR21HhTy8nOt6jf20w0c9CADrw1O8d+VZ/YzzCt4bJ3uBjw+D1q2osAB8RnpwwaeYBxy0HyKQxD5JBMuuQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.16" + } + }, "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", @@ -5217,6 +5576,13 @@ "node": ">= 14" } }, + "node_modules/deprecation": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", + "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==", + "dev": true, + "license": "ISC" + }, "node_modules/dequal": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", @@ -6353,6 +6719,19 @@ "node": ">=8" } }, + "node_modules/filter-obj": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-5.1.0.tgz", + "integrity": "sha512-qWeTREPoT7I0bifpPUXtxkZJ1XJzxWtfoWWkdVGqa+eCr3SHW/Ocp89o8vLvbUuQnadybJpjOKu4V+RwO6sGng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -7529,6 +7908,19 @@ "dev": true, "license": "MIT" }, + "node_modules/isbinaryfile": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-5.0.7.tgz", + "integrity": "sha512-gnWD14Jh3FzS3CPhF0AxNOJ8CxqeblPTADzI38r0wt8ZyQl5edpy75myt08EG2oKvpyiqSqsx+Wkz9vtkbTqYQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -9915,6 +10307,19 @@ "node": ">=16 || 14 >=14.17" } }, + "node_modules/mlly": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.0.tgz", + "integrity": "sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.15.0", + "pathe": "^2.0.3", + "pkg-types": "^1.3.1", + "ufo": "^1.6.1" + } + }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -10697,6 +11102,38 @@ "node": ">=10" } }, + "node_modules/pkg-pr-new": { + "version": "0.0.65", + "resolved": "https://registry.npmjs.org/pkg-pr-new/-/pkg-pr-new-0.0.65.tgz", + "integrity": "sha512-yZGN17qf6SX/go2rlLL3OWtwO0ppKZBxAfG5M3a9N44WMDrhqkuyfQOpKdvRE9plFsCzF7L/Xtp/1hQQHqhhCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@actions/core": "^3.0.0", + "@jsdevtools/ez-spawn": "^3.0.4", + "@octokit/action": "^6.1.0", + "ignore": "^5.3.1", + "isbinaryfile": "^5.0.2", + "pkg-types": "^1.1.1", + "query-registry": "^3.0.1", + "tinyglobby": "^0.2.9" + }, + "bin": { + "pkg-pr-new": "bin/cli.js" + } + }, + "node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, "node_modules/please-upgrade-node": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", @@ -10871,6 +11308,34 @@ "node": ">=6" } }, + "node_modules/query-registry": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/query-registry/-/query-registry-3.0.1.tgz", + "integrity": "sha512-M9RxRITi2mHMVPU5zysNjctUT8bAPx6ltEXo/ir9+qmiM47Y7f0Ir3+OxUO5OjYAWdicBQRew7RtHtqUXydqlg==", + "dev": true, + "license": "MIT", + "dependencies": { + "query-string": "^9.0.0", + "quick-lru": "^7.0.0", + "url-join": "^5.0.0", + "validate-npm-package-name": "^5.0.1", + "zod": "^3.23.8", + "zod-package-json": "^1.0.3" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/query-registry/node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/query-selector-shadow-dom": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/query-selector-shadow-dom/-/query-selector-shadow-dom-1.0.1.tgz", @@ -10878,6 +11343,24 @@ "dev": true, "license": "MIT" }, + "node_modules/query-string": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/query-string/-/query-string-9.3.1.tgz", + "integrity": "sha512-5fBfMOcDi5SA9qj5jZhWAcTtDfKF5WFdd2uD9nVNlbxVv1baq65aALy6qofpNEGELHvisjjasxQp7BlM9gvMzw==", + "dev": true, + "license": "MIT", + "dependencies": { + "decode-uri-component": "^0.4.1", + "filter-obj": "^5.1.0", + "split-on-first": "^3.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/querystringify": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", @@ -10906,6 +11389,19 @@ ], "license": "MIT" }, + "node_modules/quick-lru": { + "version": "7.3.0", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-7.3.0.tgz", + "integrity": "sha512-k9lSsjl36EJdK7I06v7APZCbyGT2vMTsYSRX1Q2nbYmnkBqgUhRkAuzH08Ciotteu/PLJmIF2+tti7o3C/ts2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -11952,6 +12448,19 @@ "dev": true, "license": "CC0-1.0" }, + "node_modules/split-on-first": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-3.0.0.tgz", + "integrity": "sha512-qxQJTx2ryR0Dw0ITYyekNQWpz6f8dGd7vffGNflQQ3Iqj9NJ6qiZ7ELpZsJ/QBhIVAiDfXdag3+Gp8RvWa62AA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/split2": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", @@ -12391,6 +12900,16 @@ "dev": true, "license": "0BSD" }, + "node_modules/tunnel": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", + "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -12404,6 +12923,16 @@ "node": ">= 0.8.0" } }, + "node_modules/type-detect": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, "node_modules/type-fest": { "version": "0.21.3", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", @@ -12431,6 +12960,13 @@ "node": ">=14.17" } }, + "node_modules/ufo": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", + "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", + "dev": true, + "license": "MIT" + }, "node_modules/unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", @@ -12478,9 +13014,9 @@ } }, "node_modules/undici": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/undici/-/undici-6.22.0.tgz", - "integrity": "sha512-hU/10obOIu62MGYjdskASR3CUAiYaFTtC9Pa6vHyf//mAipSvSQg6od2CnJswq7fvzNS3zJhxoRkgNVaHurWKw==", + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz", + "integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==", "dev": true, "license": "MIT", "engines": { @@ -12612,6 +13148,13 @@ "url": "https://opencollective.com/unified" } }, + "node_modules/universal-user-agent": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", + "integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ==", + "dev": true, + "license": "ISC" + }, "node_modules/universalify": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz", @@ -12663,6 +13206,16 @@ "punycode": "^2.1.0" } }, + "node_modules/url-join": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-5.0.0.tgz", + "integrity": "sha512-n2huDr9h9yzd6exQVnH/jU5mr+Pfx08LRXXZhkLLetAMESRj+anQsTAh940iMrIetKAmry9coFuZQ2jY8/p3WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, "node_modules/url-parse": { "version": "1.5.10", "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", @@ -12728,6 +13281,16 @@ "spdx-expression-parse": "^3.0.0" } }, + "node_modules/validate-npm-package-name": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.1.tgz", + "integrity": "sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==", + "dev": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, "node_modules/vfile": { "version": "5.3.7", "resolved": "https://registry.npmjs.org/vfile/-/vfile-5.3.7.tgz", @@ -13565,6 +14128,29 @@ "url": "https://github.com/sponsors/colinhacks" } }, + "node_modules/zod-package-json": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/zod-package-json/-/zod-package-json-1.2.0.tgz", + "integrity": "sha512-tamtgPM3MkP+obfO2dLr/G+nYoYkpJKmuHdYEy6IXRKfLybruoJ5NUj0lM0LxwOpC9PpoGLbll1ecoeyj43Wsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "zod": "^3.25.64" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/zod-package-json/node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, "node_modules/zwitch": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-2.0.4.tgz", diff --git a/package.json b/package.json index 345fd156ca..254bd68ba3 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "lint-staged": "^15.1.0", "msw": "^2.6.3", "pixelmatch": "^7.1.0", + "pkg-pr-new": "^0.0.65", "rollup": "^4.9.6", "rollup-plugin-string": "^3.0.0", "rollup-plugin-visualizer": "^5.12.0", From b5a2fcdd19e3d8581df8f2e3f01006bb9ced0e85 Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 3 Mar 2026 12:42:57 +0000 Subject: [PATCH 02/13] Only run CR in processing repo --- .github/workflows/continuous-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index c8ea3651cb..0df3711a42 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -15,6 +15,7 @@ permissions: {} jobs: publish: + if: github.repository == 'processing/p5.js' runs-on: ubuntu-latest steps: - name: Checkout code From d4a966bf854f01b027c8ae097049d29e631497a2 Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 3 Mar 2026 13:17:23 +0000 Subject: [PATCH 03/13] Provide PR write permission and set URL --- .github/workflows/continuous-release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index 0df3711a42..bcc62bc1de 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -17,6 +17,8 @@ jobs: publish: if: github.repository == 'processing/p5.js' runs-on: ubuntu-latest + permissions: + pull_requests: write steps: - name: Checkout code uses: actions/checkout@v4 @@ -46,7 +48,7 @@ jobs: .join('\n'); const cdnLinks = output.packages - .map((p) => `- ${p.name}: ${p.url.replace('pkg.pr.new', 'raw.esm.sh/pr')}/lib/p5.min.js`) + .map((p) => `- ${p.name}: https://raw.esm.sh/pr/p5@${p.sha}/lib/p5.min.js`) .join('\n'); const sha = From 0b893fea1446eb533f979fd0eb505f0e29d977aa Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 3 Mar 2026 13:20:18 +0000 Subject: [PATCH 04/13] Tying to get CI to run on PR push --- .github/workflows/continuous-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index bcc62bc1de..b39e616470 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -1,8 +1,6 @@ name: Publish approved pull requests and latest commit to pkg.pr.new on: pull_request: - types: - - opened branches: - 'dev-2.0' push: From 8fdac7192ee464a58db5e6e660d6ecbbe7965520 Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 3 Mar 2026 13:22:17 +0000 Subject: [PATCH 05/13] Another fix on CR running and commenting --- .github/workflows/continuous-release.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index b39e616470..18036143bf 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -1,6 +1,8 @@ name: Publish approved pull requests and latest commit to pkg.pr.new on: pull_request: + types: + - opened branches: - 'dev-2.0' push: @@ -16,7 +18,7 @@ jobs: if: github.repository == 'processing/p5.js' runs-on: ubuntu-latest permissions: - pull_requests: write + issues: write steps: - name: Checkout code uses: actions/checkout@v4 From da46ad6d89cd902f10e724159233fc46ddb9ccd7 Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 3 Mar 2026 13:25:02 +0000 Subject: [PATCH 06/13] We will squash merge this --- .github/workflows/continuous-release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index 18036143bf..152659224d 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -1,8 +1,6 @@ name: Publish approved pull requests and latest commit to pkg.pr.new on: pull_request: - types: - - opened branches: - 'dev-2.0' push: From 8a72ea46546efcd646407d7a8f16424cbb359325 Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 3 Mar 2026 13:33:41 +0000 Subject: [PATCH 07/13] This may be the correct key --- .github/workflows/continuous-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index 152659224d..de737f801c 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -16,7 +16,7 @@ jobs: if: github.repository == 'processing/p5.js' runs-on: ubuntu-latest permissions: - issues: write + pull-requests: write steps: - name: Checkout code uses: actions/checkout@v4 From 28394b663213eed4a3d1400d03162be913dd03da Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 3 Mar 2026 13:41:15 +0000 Subject: [PATCH 08/13] Possibly this --- .github/workflows/continuous-release.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index de737f801c..f6c91e7d9d 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -9,14 +9,13 @@ on: tags: - '!**' -permissions: {} +permissions: + pull-requests: write jobs: publish: if: github.repository == 'processing/p5.js' runs-on: ubuntu-latest - permissions: - pull-requests: write steps: - name: Checkout code uses: actions/checkout@v4 From 779fe764a3cfba3f346fd8c0d43d97c2ff0c3c22 Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Tue, 3 Mar 2026 13:45:10 +0000 Subject: [PATCH 09/13] Another attempt --- .github/workflows/continuous-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index f6c91e7d9d..d27931a200 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -11,6 +11,7 @@ on: permissions: pull-requests: write + issues: write jobs: publish: From 9ba1e9f402c89f07d5cb53810833402b474282d5 Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Wed, 4 Mar 2026 12:27:14 +0000 Subject: [PATCH 10/13] Use account based access token --- .github/workflows/continuous-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index d27931a200..1934f7c8f4 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -36,7 +36,7 @@ jobs: - name: Post or update comment uses: actions/github-script@v8 with: - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: ${{ secrets.ACCESS_TOKEN }} script: | const fs = require('fs'); const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); From be704cc227beb23fdaf3d47282560f6503392fec Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Wed, 4 Mar 2026 21:11:24 +0000 Subject: [PATCH 11/13] Switch to uploading artifact and Github App --- .github/workflows/continuous-release.yml | 230 ++++++++++++----------- 1 file changed, 118 insertions(+), 112 deletions(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index 1934f7c8f4..45c33809c5 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -33,116 +33,122 @@ jobs: - name: Publish library run: npx pkg-pr-new publish --no-template --json output.json --comment=off - - name: Post or update comment - uses: actions/github-script@v8 + - name: Upload output data + uses: actions/upload-artifact@v4 with: - github-token: ${{ secrets.ACCESS_TOKEN }} - script: | - const fs = require('fs'); - const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); - - const packages = output.packages - .map((p) => `- ${p.name}: ${p.url}`) - .join('\n'); - - const cdnLinks = output.packages - .map((p) => `- ${p.name}: https://raw.esm.sh/pr/p5@${p.sha}/lib/p5.min.js`) - .join('\n'); - - const sha = - context.event_name === 'pull_request' - ? context.payload.pull_request.head.sha - : context.payload.after; - - const commitUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${sha}`; - - const body = `## Continuous Release - - ### CDN link - - ${cdnLinks} - - ### Published Packages: - - ${packages} - - [View Commit](${commitUrl}) - - --- - - _This is an automated message._`; - - const botCommentIdentifier = '## Continuous Release'; - - async function findBotComment(issueNumber) { - if (!issueNumber) return null; - const comments = await github.rest.issues.listComments({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issueNumber, - }); - return comments.data.find((comment) => - comment.body.includes(botCommentIdentifier) - ); - } - - async function createOrUpdateComment(issueNumber) { - if (!issueNumber) { - console.log('No issue number provided. Cannot post or update comment.'); - return; - } - - const existingComment = await findBotComment(issueNumber); - if (existingComment) { - await github.rest.issues.updateComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: existingComment.id, - body: body, - }); - } else { - await github.rest.issues.createComment({ - issue_number: issueNumber, - owner: context.repo.owner, - repo: context.repo.repo, - body: body, - }); - } - } - - async function logPublishInfo() { - console.log('\n' + '='.repeat(50)); - console.log('Publish Information'); - console.log('='.repeat(50)); - console.log('\nPublished Packages:'); - console.log(packages); - console.log('\nTemplates:'); - console.log(templates); - console.log(`\nCommit URL: ${commitUrl}`); - console.log('\n' + '='.repeat(50)); - } - - if (context.eventName === 'pull_request') { - if (context.issue.number) { - await createOrUpdateComment(context.issue.number); - } - } else if (context.eventName === 'push') { - const pullRequests = await github.rest.pulls.list({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'open', - head: `${context.repo.owner}:${context.ref.replace( - 'refs/heads/', - '' - )}`, - }); - - if (pullRequests.data.length > 0) { - await createOrUpdateComment(pullRequests.data[0].number); - } else { - console.log( - 'No open pull request found for this push. Logging publish information to console:' - ); - await logPublishInfo(); - } - } \ No newline at end of file + name: output.json + path: output.json + + # - name: Post or update comment + # uses: actions/github-script@v8 + # with: + # github-token: ${{ secrets.ACCESS_TOKEN }} + # script: | + # const fs = require('fs'); + # const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); + + # const packages = output.packages + # .map((p) => `- ${p.name}: ${p.url}`) + # .join('\n'); + + # const cdnLinks = output.packages + # .map((p) => `- ${p.name}: https://raw.esm.sh/pr/p5@${p.sha}/lib/p5.min.js`) + # .join('\n'); + + # const sha = + # context.event_name === 'pull_request' + # ? context.payload.pull_request.head.sha + # : context.payload.after; + + # const commitUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${sha}`; + + # const body = `## Continuous Release + + # ### CDN link + + # ${cdnLinks} + + # ### Published Packages: + + # ${packages} + + # [View Commit](${commitUrl}) + + # --- + + # _This is an automated message._`; + + # const botCommentIdentifier = '## Continuous Release'; + + # async function findBotComment(issueNumber) { + # if (!issueNumber) return null; + # const comments = await github.rest.issues.listComments({ + # owner: context.repo.owner, + # repo: context.repo.repo, + # issue_number: issueNumber, + # }); + # return comments.data.find((comment) => + # comment.body.includes(botCommentIdentifier) + # ); + # } + + # async function createOrUpdateComment(issueNumber) { + # if (!issueNumber) { + # console.log('No issue number provided. Cannot post or update comment.'); + # return; + # } + + # const existingComment = await findBotComment(issueNumber); + # if (existingComment) { + # await github.rest.issues.updateComment({ + # owner: context.repo.owner, + # repo: context.repo.repo, + # comment_id: existingComment.id, + # body: body, + # }); + # } else { + # await github.rest.issues.createComment({ + # issue_number: issueNumber, + # owner: context.repo.owner, + # repo: context.repo.repo, + # body: body, + # }); + # } + # } + + # async function logPublishInfo() { + # console.log('\n' + '='.repeat(50)); + # console.log('Publish Information'); + # console.log('='.repeat(50)); + # console.log('\nPublished Packages:'); + # console.log(packages); + # console.log('\nTemplates:'); + # console.log(templates); + # console.log(`\nCommit URL: ${commitUrl}`); + # console.log('\n' + '='.repeat(50)); + # } + + # if (context.eventName === 'pull_request') { + # if (context.issue.number) { + # await createOrUpdateComment(context.issue.number); + # } + # } else if (context.eventName === 'push') { + # const pullRequests = await github.rest.pulls.list({ + # owner: context.repo.owner, + # repo: context.repo.repo, + # state: 'open', + # head: `${context.repo.owner}:${context.ref.replace( + # 'refs/heads/', + # '' + # )}`, + # }); + + # if (pullRequests.data.length > 0) { + # await createOrUpdateComment(pullRequests.data[0].number); + # } else { + # console.log( + # 'No open pull request found for this push. Logging publish information to console:' + # ); + # await logPublishInfo(); + # } + # } \ No newline at end of file From 28ae294cd8067694e6f209bb721ea7df3cea8fc6 Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Thu, 5 Mar 2026 11:40:29 +0000 Subject: [PATCH 12/13] Include PR number in output.json --- .github/workflows/continuous-release.yml | 131 +++-------------------- 1 file changed, 16 insertions(+), 115 deletions(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index 45c33809c5..7409e879c4 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -33,122 +33,23 @@ jobs: - name: Publish library run: npx pkg-pr-new publish --no-template --json output.json --comment=off + - name: Include PR info in output file + uses: actions/github-script@v8 + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + with: + script: | + const fs = require('fs'); + const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); + output.workflow = { + pull_request: process.env.PR_NUMBER ? { + number: process.env.PR_NUMBER + } : null + }; + fs.writeFileSync('output.json', JSON.stringify(output)); + - name: Upload output data uses: actions/upload-artifact@v4 with: name: output.json - path: output.json - - # - name: Post or update comment - # uses: actions/github-script@v8 - # with: - # github-token: ${{ secrets.ACCESS_TOKEN }} - # script: | - # const fs = require('fs'); - # const output = JSON.parse(fs.readFileSync('output.json', 'utf8')); - - # const packages = output.packages - # .map((p) => `- ${p.name}: ${p.url}`) - # .join('\n'); - - # const cdnLinks = output.packages - # .map((p) => `- ${p.name}: https://raw.esm.sh/pr/p5@${p.sha}/lib/p5.min.js`) - # .join('\n'); - - # const sha = - # context.event_name === 'pull_request' - # ? context.payload.pull_request.head.sha - # : context.payload.after; - - # const commitUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/commit/${sha}`; - - # const body = `## Continuous Release - - # ### CDN link - - # ${cdnLinks} - - # ### Published Packages: - - # ${packages} - - # [View Commit](${commitUrl}) - - # --- - - # _This is an automated message._`; - - # const botCommentIdentifier = '## Continuous Release'; - - # async function findBotComment(issueNumber) { - # if (!issueNumber) return null; - # const comments = await github.rest.issues.listComments({ - # owner: context.repo.owner, - # repo: context.repo.repo, - # issue_number: issueNumber, - # }); - # return comments.data.find((comment) => - # comment.body.includes(botCommentIdentifier) - # ); - # } - - # async function createOrUpdateComment(issueNumber) { - # if (!issueNumber) { - # console.log('No issue number provided. Cannot post or update comment.'); - # return; - # } - - # const existingComment = await findBotComment(issueNumber); - # if (existingComment) { - # await github.rest.issues.updateComment({ - # owner: context.repo.owner, - # repo: context.repo.repo, - # comment_id: existingComment.id, - # body: body, - # }); - # } else { - # await github.rest.issues.createComment({ - # issue_number: issueNumber, - # owner: context.repo.owner, - # repo: context.repo.repo, - # body: body, - # }); - # } - # } - - # async function logPublishInfo() { - # console.log('\n' + '='.repeat(50)); - # console.log('Publish Information'); - # console.log('='.repeat(50)); - # console.log('\nPublished Packages:'); - # console.log(packages); - # console.log('\nTemplates:'); - # console.log(templates); - # console.log(`\nCommit URL: ${commitUrl}`); - # console.log('\n' + '='.repeat(50)); - # } - - # if (context.eventName === 'pull_request') { - # if (context.issue.number) { - # await createOrUpdateComment(context.issue.number); - # } - # } else if (context.eventName === 'push') { - # const pullRequests = await github.rest.pulls.list({ - # owner: context.repo.owner, - # repo: context.repo.repo, - # state: 'open', - # head: `${context.repo.owner}:${context.ref.replace( - # 'refs/heads/', - # '' - # )}`, - # }); - - # if (pullRequests.data.length > 0) { - # await createOrUpdateComment(pullRequests.data[0].number); - # } else { - # console.log( - # 'No open pull request found for this push. Logging publish information to console:' - # ); - # await logPublishInfo(); - # } - # } \ No newline at end of file + path: output.json \ No newline at end of file From da8a3365c47a33fe9db4ff00e5cc3e53a99449eb Mon Sep 17 00:00:00 2001 From: limzykenneth Date: Fri, 6 Mar 2026 10:25:18 +0000 Subject: [PATCH 13/13] Rename output artifact file --- .github/workflows/continuous-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-release.yml b/.github/workflows/continuous-release.yml index 7409e879c4..44114d0f49 100644 --- a/.github/workflows/continuous-release.yml +++ b/.github/workflows/continuous-release.yml @@ -51,5 +51,5 @@ jobs: - name: Upload output data uses: actions/upload-artifact@v4 with: - name: output.json + name: output.zip path: output.json \ No newline at end of file