From 1acc5241a34ae8bc11d6bbe85a7b2f4dad0203c8 Mon Sep 17 00:00:00 2001 From: MickLesk <47820557+MickLesk@users.noreply.github.com> Date: Wed, 16 Sep 2026 13:16:20 +0200 Subject: [PATCH] pocketbase-bot: write the sync PR against the PR template The sync PR body had its own Summary and Source headings, so the autolabeler found none of the template checkboxes it looks for and the PR came out with nothing but "needs triage". It also never referenced the issue the command came from. Write the body the way the template expects, with the Website update box ticked, which is what a PocketBase sync is. Tested thoroughly stays unticked and Tested on says not tested, because nothing here was run; close-invalid-pr-template skips bot authors, so that costs nothing. Reference the triggering number as Fixes when the command came from an issue and as a plain mention when it came from a PR comment, where Fixes would point the PR at itself. issue_comment carries both under github.event.issue, so the new IS_PR_COMMENT tells them apart. --- .github/workflows/pocketbase-bot.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pocketbase-bot.yml b/.github/workflows/pocketbase-bot.yml index 497f763b2..11d0eca97 100644 --- a/.github/workflows/pocketbase-bot.yml +++ b/.github/workflows/pocketbase-bot.yml @@ -26,6 +26,7 @@ jobs: COMMENT_BODY: ${{ github.event.comment.body }} COMMENT_ID: ${{ github.event.comment.id }} ISSUE_NUMBER: ${{ github.event.issue.number }} + IS_PR_COMMENT: ${{ github.event.issue.pull_request && 'true' || 'false' }} REPO_OWNER: ${{ github.repository_owner }} REPO_NAME: ${{ github.event.repository.name }} ACTOR: ${{ github.event.comment.user.login }} @@ -84,6 +85,7 @@ jobs: const owner = process.env.REPO_OWNER; const repo = process.env.REPO_NAME; const issueNumber = parseInt(process.env.ISSUE_NUMBER, 10); + const isPrComment = process.env.IS_PR_COMMENT === 'true'; const commentId = parseInt(process.env.COMMENT_ID, 10); const actor = process.env.ACTOR; @@ -216,11 +218,22 @@ jobs: const prTitle = 'chore(ct): sync ' + slugValue + ' defaults with PocketBase'; const prBody = - '## Summary\n' + - '- Sync default CT variables for `' + slugValue + '` after `/pocketbase` update.\n' + - '- Updated vars: `' + updateResult.updatedVars.join('`, `') + '`.\n\n' + - '## Source\n' + - '- Triggered by @' + actor + ' via PocketBase bot.\n'; + '## ✍️ Description\n\n' + + 'Sync of the default CT variables for `' + slugValue + '` after a `/pocketbase` update by @' + actor + '.\n\n' + + 'Updated: `' + updateResult.updatedVars.join('`, `') + '`\n\n' + + '## 🔗 Related Issue\n\n' + + (isPrComment ? 'Triggered from #' : 'Fixes #') + issueNumber + '\n\n' + + '## ✅ Prerequisites (**X** in brackets)\n\n' + + '- [x] **Self-review completed** – Code follows project standards.\n' + + '- [ ] **Tested thoroughly** – Changes work as expected.\n' + + '- [x] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues.\n\n' + + '**Tested on:** not tested — generated from the PocketBase record, only `var_` defaults changed.\n\n' + + '---\n\n' + + '## 🤖 AI Assistance (**X** in brackets)\n\n' + + '- [x] **No AI used** – Scripts were written without AI assistance.\n\n' + + '---\n\n' + + '## 🛠️ Type of Change (**X** in brackets)\n\n' + + '- [x] 🌍 **Website update** – Changes to script metadata (PocketBase/website data).\n'; const createPrRes = await ghRequest('/repos/' + owner + '/' + repo + '/pulls', 'POST', { title: prTitle, body: prBody,