Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 56 additions & 28 deletions .github/workflows/proposal-numbering.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,42 +99,70 @@ 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 => `- <code>${f}</code>`).join('\n');
if (filesNeedingFix.size > 0) {
const files = Array.from(filesNeedingFix);
const filesList = files.map(f => `- <code>${f}</code>`).join('\n');

warnings.push(
'**Incorrect filename:**',
'**Issues found:**',
'',
filesList,
'',
`**Expected naming:** <code>${expectedPrefix}&lt;descriptive-name&gt;.md</code>`,
'',
`Rename your proposal file to use PR #${prNumber}:`,
'',
'```bash',
`git mv proposals/000-<name>.md ${expectedPrefix}<name>.md`,
'```'
''
);
}

// Check title issues
if (incorrectTitlesRaw) {
const titlesList = incorrectTitlesRaw.split(',').map(f => `- <code>${f}</code>`).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 <code>${file}</code>:**`,
'',
'```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`,
`git add ${targetFile}`
);
}

warnings.push(
`git commit -m "Rename proposal to use PR number ${prNumber}"`,
'git push',
'```',
''
);
}
});

warnings.push(
'**Incorrect title format:**',
'',
titlesList,
'',
`**Expected title format:** <code># ${prNumber} - &lt;Your Title&gt;</code>`,
'',
`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.',
''
);
}

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.claude/settings.local.json
47 changes: 37 additions & 10 deletions notify-open-prs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
Loading