Skip to content
Closed
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
161 changes: 161 additions & 0 deletions .github/workflows/proposal-numbering.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: Check Proposal Numbering

on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- 'proposals/*.md'

permissions:
pull-requests: write
contents: read

jobs:
check-numbering:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Check proposal file numbering
id: check
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
# Find all .md files directly in proposals directory (not subdirectories)
ALL_PROPOSAL_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '^proposals/[^/]*\.md$' || true)

# Filter out non-proposal files (README.md and template)
PROPOSAL_FILES=""
for file in $ALL_PROPOSAL_FILES; do
# Skip README.md and the template
if [[ "$file" == "proposals/README.md" ]] || [[ "$file" == "proposals/000-template.md" ]]; then
continue
fi
PROPOSAL_FILES="$PROPOSAL_FILES $file"
done

if [ -z "$PROPOSAL_FILES" ]; then
echo "No proposal files found in this PR"
echo "has_proposal=false" >> $GITHUB_OUTPUT
exit 0
fi

echo "has_proposal=true" >> $GITHUB_OUTPUT

# Expected filename pattern: proposals/0{PR_NUMBER}-*.md
EXPECTED_PREFIX=$(printf "proposals/%03d-" $PR_NUMBER)

INCORRECT_FILES=""
for file in $PROPOSAL_FILES; do
if [[ ! "$file" =~ ^${EXPECTED_PREFIX} ]]; then
if [ -z "$INCORRECT_FILES" ]; then
INCORRECT_FILES="$file"
else
INCORRECT_FILES="$INCORRECT_FILES,$file"
fi
fi
done

if [ -n "$INCORRECT_FILES" ]; then
echo "incorrect=true" >> $GITHUB_OUTPUT
echo "files=$INCORRECT_FILES" >> $GITHUB_OUTPUT
echo "expected_prefix=$EXPECTED_PREFIX" >> $GITHUB_OUTPUT
else
echo "incorrect=false" >> $GITHUB_OUTPUT
fi

- name: Update PR description if numbering is incorrect
if: steps.check.outputs.incorrect == 'true'
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;
const expectedPrefix = '${{ steps.check.outputs.expected_prefix }}';
const incorrectFilesRaw = '${{ steps.check.outputs.files }}';

// Format files as markdown list
const filesList = incorrectFilesRaw.split(',').map(f => `- <code>${f}</code>`).join('\n');

const warningSection = [
'---',
'',
'## ⚠️ Proposal File Numbering',
'',
'This PR contains proposal files that don\'t follow the expected numbering scheme:',
'',
filesList,
'',
`**Expected naming:** <code>${expectedPrefix}&lt;descriptive-name&gt;.md</code>`,
'',
`Please rename your proposal file to use PR #${prNumber}:`,
'',
'```bash',
`git mv proposals/000-<name>.md ${expectedPrefix}<name>.md`,
'# or rename from current name to correct name',
`git commit -m "Rename proposal to use PR number ${prNumber}"`,
'git push',
'```',
'',
'See [proposals/README.md](https://github.com/kroxylicious/design/blob/main/proposals/README.md) for the complete workflow.',
'',
'<!-- proposal-numbering-check -->'
].join('\n');

// Get current PR
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});

let currentBody = pr.body || '';

// Remove existing warning section if present
const markerRegex = /---\s*\n\s*##\s*⚠️\s*Proposal File Numbering[\s\S]*?<!-- proposal-numbering-check -->/;
currentBody = currentBody.replace(markerRegex, '').trim();

// Append new warning section
const newBody = currentBody + '\n' + warningSection;

await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
body: newBody
});

- name: Remove warning from PR description if numbering is correct
if: steps.check.outputs.has_proposal == 'true' && steps.check.outputs.incorrect == 'false'
uses: actions/github-script@v7
with:
script: |
const prNumber = context.payload.pull_request.number;

// Get current PR
const { data: pr } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
});

let currentBody = pr.body || '';

// Check if warning section exists
const markerRegex = /---\s*\n\s*##\s*⚠️\s*Proposal File Numbering[\s\S]*?<!-- proposal-numbering-check -->/;

if (markerRegex.test(currentBody)) {
// Remove warning section
const newBody = currentBody.replace(markerRegex, '').trim();

await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: prNumber,
body: newBody
});

console.log('Removed numbering warning from PR description - file is now correctly named');
}
109 changes: 109 additions & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Proposal Numbering Migration Guide

This guide contains the migration instructions for existing open proposal PRs to adopt the new PR-number-based numbering system.

## Background

We've adopted a new proposal numbering system where proposal numbers match their PR numbers. This eliminates collisions and simplifies the workflow.

## Migration Instructions by PR

### PR #70 - Routing API
**Current file:** `proposals/004-routing-api.md`
**New file:** `proposals/070-routing-api.md`

```bash
git mv proposals/004-routing-api.md proposals/070-routing-api.md
git commit -m "Rename proposal to use PR number 70"
git push
```

### PR #82 - Kroxylicious 1.0
**Current file:** `proposals/007-kroxylicious-1.0.md`
**New file:** `proposals/082-kroxylicious-1.0.md`

```bash
git mv proposals/007-kroxylicious-1.0.md proposals/082-kroxylicious-1.0.md
git commit -m "Rename proposal to use PR number 82"
git push
```

### PR #83 - Hot Reload Feature
**Current file:** `proposals/012-hot-reload-feature.md`
**New file:** `proposals/083-hot-reload-feature.md`

```bash
git mv proposals/012-hot-reload-feature.md proposals/083-hot-reload-feature.md
git commit -m "Rename proposal to use PR number 83"
git push
```

### PR #85 - Audit Logging
**Current file:** `proposals/nnn-audit-logging.md`
**New file:** `proposals/085-audit-logging.md`

```bash
git mv proposals/nnn-audit-logging.md proposals/085-audit-logging.md
git commit -m "Rename proposal to use PR number 85"
git push
```

### PR #88 - Frontend Handler Refactoring
**Current file:** `proposals/014-frontend-handler-refactoring-and-centralised-session-context.md`
**New file:** `proposals/088-frontend-handler-refactoring-and-centralised-session-context.md`

```bash
git mv proposals/014-frontend-handler-refactoring-and-centralised-session-context.md proposals/088-frontend-handler-refactoring-and-centralised-session-context.md
git commit -m "Rename proposal to use PR number 88"
git push
```

### PR #93 - Correlated Request/Response Data API
**Current file:** `proposals/xxx-correlated-request-response-data-api.md`
**New file:** `proposals/093-correlated-request-response-data-api.md`

```bash
git mv proposals/xxx-correlated-request-response-data-api.md proposals/093-correlated-request-response-data-api.md
git commit -m "Rename proposal to use PR number 93"
git push
```

### PR #94 - TLS Configuration Deprecation
**Current file:** `proposals/nnn-tls-configuration.md`
**New file:** `proposals/094-tls-configuration.md`

```bash
git mv proposals/nnn-tls-configuration.md proposals/094-tls-configuration.md
git commit -m "Rename proposal to use PR number 94"
git push
```

## Comment Template for PR Authors

Use this template to comment on each PR:

---

Hi! We've updated the proposal numbering system to use PR numbers instead of sequential allocation. This eliminates number collisions and simplifies the workflow.

**Action required:** Please rename your proposal file to use this PR's number.

**Current file:** `proposals/XXX-name.md`
**New file:** `proposals/0YY-name.md`

```bash
git mv proposals/XXX-name.md proposals/0YY-name.md
git commit -m "Rename proposal to use PR number YY"
git push
```

See [proposals/README.md](https://github.com/kroxylicious/design/blob/main/proposals/README.md) for the updated workflow. Going forward, a GitHub Action will automatically remind you if the filename doesn't match the PR number.

---

## After Migration

Once all open PRs have been renamed:
- The GitHub workflow will automatically check new proposals
- No manual index maintenance is needed - the directory listing is the index
- Proposal numbers will match PR numbers going forward
16 changes: 15 additions & 1 deletion proposals/000-template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
<!-- This template is provided as an example with sections you may wish to comment on with respect to your proposal. Add or remove sections as required to best articulate the proposal. -->
<!--
PROPOSAL WORKFLOW:
1. Copy this template to: proposals/000-<descriptive-name>.md
2. Fill in your proposal content
3. Open a PR on GitHub
4. Rename the file to use your PR number: proposals/<PR#>-<descriptive-name>.md
Example: git mv proposals/000-my-feature.md proposals/105-my-feature.md
5. Push the rename to your PR

See proposals/README.md for complete instructions.

This template is provided as an example with sections you may wish to comment on with respect to your proposal. Add or remove sections as required to best articulate the proposal.
-->

# <Title>

**Proposal**: #<PR-NUMBER> <!-- Update this after opening your PR -->

Provide a brief summary of the feature you are proposing to add to Kroxylicious.

## Current situation
Expand Down
13 changes: 13 additions & 0 deletions proposals/002-test-workflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Test Proposal for Workflow

**Proposal**: #TBD

This is a test proposal to verify the GitHub workflow correctly detects incorrect proposal numbering and updates the PR description.

## Purpose

Verify that:
1. The workflow detects this file (starts with 000-)
2. The workflow updates the PR description with a warning
3. The workflow provides the correct renaming command
4. HTML entities are used instead of backticks (cleaner syntax)
Loading
Loading