From 96df1ebcfa8a48e02ab544f5d81b147c507d0235 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Tue, 28 Apr 2026 10:43:44 +0100 Subject: [PATCH 1/3] Provide exact copy-pasteable commands in workflow warnings Update the workflow to generate specific fix commands for each proposal: - Exact git mv command with actual current and expected filenames - Smart sed command that preserves title text while fixing the number - Include git commit and git push for complete fix workflow The sed command handles titles with or without existing number prefixes (e.g., '# 000 - Title', '# xxx - Title', or '# Title') and automatically adds the correct PR number while preserving the title text. Users can now copy/paste the entire command block directly into their terminal without manual editing. Assisted-By: Claude Sonnet 4.5 Signed-off-by: Keith Wall --- .github/workflows/proposal-numbering.yml | 83 ++++++++++++++++-------- 1 file changed, 55 insertions(+), 28 deletions(-) diff --git a/.github/workflows/proposal-numbering.yml b/.github/workflows/proposal-numbering.yml index 5de7e9c..f6f5fb1 100644 --- a/.github/workflows/proposal-numbering.yml +++ b/.github/workflows/proposal-numbering.yml @@ -99,42 +99,69 @@ jobs: const incorrectFilesRaw = '${{ steps.check.outputs.files }}'; const incorrectTitlesRaw = '${{ steps.check.outputs.titles }}'; + // Get all files that need fixing (union of incorrect filenames and incorrect titles) + const filesNeedingFix = new Set(); + if (incorrectFilesRaw) { + incorrectFilesRaw.split(',').forEach(f => filesNeedingFix.add(f.trim())); + } + if (incorrectTitlesRaw) { + incorrectTitlesRaw.split(',').forEach(f => filesNeedingFix.add(f.trim())); + } + const warnings = []; - // Check filename issues - if (incorrectFilesRaw) { - const filesList = incorrectFilesRaw.split(',').map(f => `- ${f}`).join('\n'); + if (filesNeedingFix.size > 0) { + const files = Array.from(filesNeedingFix); + const filesList = files.map(f => `- ${f}`).join('\n'); + warnings.push( - '**Incorrect filename:**', + '**Issues found:**', '', filesList, - '', - `**Expected naming:** ${expectedPrefix}<descriptive-name>.md`, - '', - `Rename your proposal file to use PR #${prNumber}:`, - '', - '```bash', - `git mv proposals/000-.md ${expectedPrefix}.md`, - '```' + '' ); - } - // Check title issues - if (incorrectTitlesRaw) { - const titlesList = incorrectTitlesRaw.split(',').map(f => `- ${f}`).join('\n'); - if (warnings.length > 0) warnings.push('', '---', ''); + // For each file, generate specific fix commands + files.forEach(file => { + const basename = file.replace('proposals/', ''); + // Strip leading numbers or placeholder prefixes to get the descriptive part + const descriptive = basename.replace(/^[0-9]{3}-/, '').replace(/^(xxx|nnn|000)-/, ''); + const expectedFilename = `proposals/${String(prNumber).padStart(3, '0')}-${descriptive}`; + + const needsRename = file !== expectedFilename; + const needsTitleUpdate = incorrectTitlesRaw && incorrectTitlesRaw.includes(file); + + if (needsRename || needsTitleUpdate) { + warnings.push( + `**Fix for ${file}:**`, + '', + '```bash' + ); + + if (needsRename) { + warnings.push(`git mv ${file} ${expectedFilename}`); + } + + if (needsTitleUpdate) { + const targetFile = needsRename ? expectedFilename : file; + warnings.push( + `# Update title: remove any old number prefix and add PR number`, + `sed -i.bak '0,/^# /{s/^# \\([0-9]\\{3\\}\\|xxx\\|nnn\\|000\\) - /# ${prNumber} - /; t; s/^# /# ${prNumber} - /}' ${targetFile} && rm ${targetFile}.bak` + ); + } + + warnings.push( + `git commit -m "Rename proposal to use PR number ${prNumber}"`, + 'git push', + '```', + '' + ); + } + }); + warnings.push( - '**Incorrect title format:**', - '', - titlesList, - '', - `**Expected title format:** # ${prNumber} - <Your Title>`, - '', - `Update the H1 heading in your proposal to include the PR number:`, - '', - '```markdown', - `# ${prNumber} - My Feature Title`, - '```' + '**Note:** The commands above can be copied and pasted directly into your terminal. The sed command will automatically preserve your title text.', + '' ); } From a839b16837e08134431bc0b6516ca429c204acbe Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Tue, 28 Apr 2026 10:50:10 +0100 Subject: [PATCH 2/3] Improve proposal numbering workflow with exact commands Workflow Changes: - Generate specific, copy-pasteable commands for each proposal - Exact git mv command with actual current and expected filenames - Smart sed command that preserves title text while fixing the number - Include git add after sed to stage the modified file - Complete workflow with git commit and git push Notification Script Changes: - Fetch actual proposal filename from each PR - Calculate expected filename - Provide exact commands including sed for title update - Include git add after sed modification The sed command handles all common title formats (# 000 -, # xxx -, # nnn -, or plain # Title) and preserves the title text. Assisted-By: Claude Sonnet 4.5 Signed-off-by: Keith Wall --- .claude/settings.local.json | 24 ++++++++++++ .github/workflows/proposal-numbering.yml | 3 +- notify-open-prs.sh | 47 +++++++++++++++++++----- 3 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 .claude/settings.local.json diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 0000000..5bd132f --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,24 @@ +{ + "permissions": { + "allow": [ + "Bash(gh pr *)", + "Bash(sort -k2)", + "Bash(git add *)", + "Bash(git commit *)", + "Bash(git push *)", + "Bash(git checkout *)", + "Bash(gh run *)", + "Bash(git rebase *)", + "Bash(git cherry-pick *)", + "Bash(gh api *)", + "Bash(gh workflow *)", + "Bash(git mv *)", + "Bash(git reset *)", + "Bash(git show *)", + "Bash(mv /tmp/working-workflow.yml .github/workflows/proposal-numbering.yml)", + "Bash(git rm *)", + "Bash(chmod +x *)", + "Bash(git branch *)" + ] + } +} diff --git a/.github/workflows/proposal-numbering.yml b/.github/workflows/proposal-numbering.yml index f6f5fb1..91d94ac 100644 --- a/.github/workflows/proposal-numbering.yml +++ b/.github/workflows/proposal-numbering.yml @@ -146,7 +146,8 @@ jobs: const targetFile = needsRename ? expectedFilename : file; warnings.push( `# Update title: remove any old number prefix and add PR number`, - `sed -i.bak '0,/^# /{s/^# \\([0-9]\\{3\\}\\|xxx\\|nnn\\|000\\) - /# ${prNumber} - /; t; s/^# /# ${prNumber} - /}' ${targetFile} && rm ${targetFile}.bak` + `sed -i.bak '0,/^# /{s/^# \\([0-9]\\{3\\}\\|xxx\\|nnn\\|000\\) - /# ${prNumber} - /; t; s/^# /# ${prNumber} - /}' ${targetFile} && rm ${targetFile}.bak`, + `git add ${targetFile}` ); } diff --git a/notify-open-prs.sh b/notify-open-prs.sh index d6a1af5..72e4986 100755 --- a/notify-open-prs.sh +++ b/notify-open-prs.sh @@ -12,14 +12,6 @@ set -e OPEN_PRS=(70 82 83 85 88 93 94 96 98 99 100 101 103) -COMMENT_BODY="Hi! We've updated the proposal numbering system to use PR numbers as proposal identifiers. - -**Action required:** Please rebase your PR on \`main\`. - -Once you push, the GitHub workflow will automatically check your proposal file naming and update this PR description with specific instructions if your file needs to be renamed. - -See [proposals/README.md](https://github.com/kroxylicious/design/blob/main/proposals/README.md) for the updated workflow." - echo "This script will comment on ${#OPEN_PRS[@]} open proposal PRs" echo "" read -p "Continue? (y/N) " -n 1 -r @@ -30,9 +22,44 @@ if [[ ! $REPLY =~ ^[Yy]$ ]]; then fi for pr in "${OPEN_PRS[@]}"; do - echo "Commenting on PR #$pr..." + echo "Processing PR #$pr..." + + # Get the proposal file(s) from this PR + PROPOSAL_FILES=$(gh pr view "$pr" --json files --jq '.files[].path' | grep '^proposals/.*\.md$' | grep -v 'proposals/README.md' | grep -v 'proposals/000-template.md' || true) + + if [ -z "$PROPOSAL_FILES" ]; then + echo " No proposal files found, skipping" + continue + fi + + # Get the first proposal file (should only be one) + PROPOSAL_FILE=$(echo "$PROPOSAL_FILES" | head -1) + CURRENT_FILENAME=$(basename "$PROPOSAL_FILE") + EXPECTED_FILENAME=$(printf "%03d-" "$pr")$(echo "$CURRENT_FILENAME" | sed 's/^[0-9]*-//' | sed 's/^[a-z]*-//') + + # Build PR-specific comment + COMMENT_BODY="Hi! We've updated the proposal numbering system to use PR numbers as proposal identifiers. + +**Action required:** Please rebase your PR on \`main\`. + +Once you rebase, you'll need to rename your proposal file and update the title: + +\`\`\`bash +git mv $PROPOSAL_FILE proposals/$EXPECTED_FILENAME +# Update title: remove any old number prefix and add PR number +sed -i.bak '0,/^# /{s/^# \\([0-9]\\{3\\}\\|xxx\\|nnn\\|000\\) - /# $pr - /; t; s/^# /# $pr - /}' proposals/$EXPECTED_FILENAME && rm proposals/$EXPECTED_FILENAME.bak +git add proposals/$EXPECTED_FILENAME +git commit -m \"Rename proposal to use PR number\" +git push +\`\`\` + +The GitHub workflow will automatically check your proposal file naming after you push and update this PR description if any corrections are still needed. + +See [proposals/README.md](https://github.com/kroxylicious/design/blob/main/proposals/README.md) for the updated workflow." + + echo " Commenting on PR #$pr (file: $CURRENT_FILENAME → $EXPECTED_FILENAME)..." gh pr comment "$pr" --body "$COMMENT_BODY" - echo "✓ PR #$pr notified" + echo " ✓ PR #$pr notified" sleep 2 # Be nice to the API done From 31396a8d919f39c6e49d7613df4f567c762a8e60 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Tue, 28 Apr 2026 11:01:34 +0100 Subject: [PATCH 3/3] Remove settings.local.json and add to .gitignore This is a local settings file that shouldn't be tracked. Assisted-By: Claude Sonnet 4.5 Signed-off-by: Keith Wall --- .claude/settings.local.json | 24 ------------------------ .gitignore | 1 + 2 files changed, 1 insertion(+), 24 deletions(-) delete mode 100644 .claude/settings.local.json diff --git a/.claude/settings.local.json b/.claude/settings.local.json deleted file mode 100644 index 5bd132f..0000000 --- a/.claude/settings.local.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "permissions": { - "allow": [ - "Bash(gh pr *)", - "Bash(sort -k2)", - "Bash(git add *)", - "Bash(git commit *)", - "Bash(git push *)", - "Bash(git checkout *)", - "Bash(gh run *)", - "Bash(git rebase *)", - "Bash(git cherry-pick *)", - "Bash(gh api *)", - "Bash(gh workflow *)", - "Bash(git mv *)", - "Bash(git reset *)", - "Bash(git show *)", - "Bash(mv /tmp/working-workflow.yml .github/workflows/proposal-numbering.yml)", - "Bash(git rm *)", - "Bash(chmod +x *)", - "Bash(git branch *)" - ] - } -} diff --git a/.gitignore b/.gitignore index 485dee6..fcb1f9b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .idea +.claude/settings.local.json