|
| 1 | +# Merged PR Report |
| 2 | + |
| 3 | +Generate a monthly report of pull requests merged into the `main`, `beta`, and `release` branches of `thunderbird/thunderbird-android`. |
| 4 | + |
| 5 | +The script `scripts/merged-pr-report.sh` produces: |
| 6 | + |
| 7 | +- A Markdown report for review |
| 8 | +- A CSV report for spreadsheet import or further processing |
| 9 | + |
| 10 | +## What it reports |
| 11 | + |
| 12 | +For each merged pull request, the report includes: |
| 13 | + |
| 14 | +- Target branch (`main`, `beta`, `release`) |
| 15 | +- PR number |
| 16 | +- Merge date |
| 17 | +- PR title |
| 18 | +- Report status from GitHub labels |
| 19 | +- First beta tag containing the merge commit |
| 20 | +- First release tag containing the merge commit |
| 21 | + |
| 22 | +The CSV report additionally includes: |
| 23 | + |
| 24 | +- PR author |
| 25 | +- Merge commit SHA |
| 26 | +- PR URL |
| 27 | +- Empty `Comment` column for manual notes |
| 28 | + |
| 29 | +## Report status labels |
| 30 | + |
| 31 | +The script reads these labels from the PR: |
| 32 | + |
| 33 | +| Label | Result | |
| 34 | +|------|--------| |
| 35 | +| `report: include` | Include | |
| 36 | +| `report: exclude` | Exclude | |
| 37 | +| `report: highlight` | Highlight | |
| 38 | +| *(none)* | Review | |
| 39 | + |
| 40 | +## Beta and Release columns |
| 41 | + |
| 42 | +For each PR merge commit, the script determines: |
| 43 | + |
| 44 | +- **Beta**: first beta tag (containing `b`) that contains the merge commit (only if the commit reached the `beta` branch) |
| 45 | +- **Release**: first production release tag (excluding `b`, including dot releases) that contains the merge commit (only if the commit reached the `release` branch) |
| 46 | + |
| 47 | +Possible values: |
| 48 | + |
| 49 | +- A tag (e.g. `THUNDERBIRD_115_0b1`, `THUNDERBIRD_115_1_0`) |
| 50 | +- `Not released yet` (commit reached the branch but is not yet tagged) |
| 51 | +- `-` (commit not present in that branch history) |
| 52 | + |
| 53 | +## How it works |
| 54 | + |
| 55 | +The script: |
| 56 | + |
| 57 | +1. Validates input (`YEAR`, `MONTH`) |
| 58 | +2. Computes the monthly date range |
| 59 | +3. Creates a temporary git repository |
| 60 | +4. Fetches: |
| 61 | + - `main`, `beta`, `release` |
| 62 | + - all tags |
| 63 | +5. Queries GitHub for merged PRs |
| 64 | +6. Maps report labels to status |
| 65 | +7. Resolves beta/release versions via git ancestry and tags |
| 66 | +8. Writes Markdown and CSV outputs |
| 67 | + |
| 68 | +To improve performance, version lookups are cached per merge commit SHA. |
| 69 | + |
| 70 | +## Usage |
| 71 | + |
| 72 | +```bash |
| 73 | +./scripts/merged-pr-report.sh YEAR MONTH [TARGET_DIR] [--skip-excluded] |
| 74 | +``` |
| 75 | + |
| 76 | +Example: |
| 77 | + |
| 78 | +```bash |
| 79 | +./scripts/merged-pr-report.sh 2026 02 |
| 80 | +./scripts/merged-pr-report.sh 2026 02 ./reports |
| 81 | +./scripts/merged-pr-report.sh 2026 02 . --skip-excluded |
| 82 | +``` |
| 83 | + |
| 84 | +Arguments: |
| 85 | + |
| 86 | +- `YEAR`: Four-digit year (e.g. 2026) |
| 87 | +- `MONTH`: Two-digit month (01-12) |
| 88 | +- `TARGET_DIR`: (Optional) Target directory for reports (default: current directory) |
| 89 | +- `--skip-excluded`: (Optional) If set, PRs with `report: exclude` label are omitted from the report |
| 90 | + |
| 91 | +## Requirements |
| 92 | + |
| 93 | +- `git` |
| 94 | +- `gh` (GitHub CLI) |
| 95 | +- `jq` |
| 96 | +- macOS / BSD `date` (uses `date -j`) |
| 97 | + |
| 98 | +Authenticate GitHub CLI: |
| 99 | + |
| 100 | +```bash |
| 101 | +gh auth login |
0 commit comments