Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

remove release notes logic (#83674)

Ryan Laurie260de05d4b39
diff --git a/.github/workflows/cut-release-branch.yml b/.github/workflows/cut-release-branch.yml
index 5155526a049..18727ca09bb 100644
--- a/.github/workflows/cut-release-branch.yml
+++ b/.github/workflows/cut-release-branch.yml
@@ -67,8 +67,7 @@ jobs:
aws-region: ${{ vars.AWS_REGION }}
# Pushing the new branch triggers set-milestone.yml, which does the
- # full milestone backfill and then dispatches release-notes-preview
- # to upload the markdown to #writing.
+ # full milestone backfill.
#
# Kondo ignore ratchets apply only to master. The cut commit replaces the
# budgets in both ratchet files with an explicit opt-out so future budget
diff --git a/.github/workflows/release-milestone-check.yml b/.github/workflows/release-milestone-check.yml
deleted file mode 100644
index a8e08788b68..00000000000
--- a/.github/workflows/release-milestone-check.yml
+++ /dev/null
@@ -1,74 +0,0 @@
-name: Release Milestone Check
-run-name: Pre-release Milestone check for ${{ inputs.version }}
-
-on:
- workflow_call:
- inputs:
- version:
- description: "Metabase version (e.g. v0.46.3)"
- type: string
- required: true
- commit:
- description: "A full-length commit SHA-1 hash"
- type: string
- required: true
- workflow_dispatch:
- inputs:
- version:
- description: "Metabase version (e.g. v0.46.3)"
- type: string
- required: true
- commit:
- description: "A full-length commit SHA-1 hash"
- required: true
-
-jobs:
- check-milestone:
- # Only run milestone check in https://github.com/metabase/metabase since this is the only place milestones are used.
- if: github.repository == 'metabase/metabase'
- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
- timeout-minutes: 10
- steps:
- - uses: actions/checkout@v7
- with:
- sparse-checkout: release
- - name: Install bun
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- with:
- bun-version-file: 'package.json'
- token: ${{ secrets.GITHUB_TOKEN }}
- - name: Prepare build scripts
- run: bun install --cwd release --frozen-lockfile && bun run --cwd release build
- - uses: actions/github-script@v9
- env:
- GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- SLACK_RELEASE_CHANNEL: ${{ vars.SLACK_RELEASE_CHANNEL }}
- SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- with:
- script: | # js
- const {
- checkMilestoneForRelease,
- sendMilestoneCheckMessage,
- } = require('${{ github.workspace }}/release/dist/index.cjs');
-
- const version = '${{ inputs.version }}';
- const commitHash = '${{ inputs.commit }}';
-
- const issueCount = await checkMilestoneForRelease({
- github,
- owner: context.repo.owner,
- repo: context.repo.repo,
- version,
- commitHash,
- });
-
- if (issueCount === undefined) {
- // checkMilestoneForRelease returns undefined for patches, which have nothing to check.
- return;
- }
-
- await sendMilestoneCheckMessage({
- channelName: process.env.SLACK_RELEASE_CHANNEL,
- issueCount,
- version,
- });
diff --git a/.github/workflows/release-notes-preview.yml b/.github/workflows/release-notes-preview.yml
deleted file mode 100644
index 71fba0ee541..00000000000
--- a/.github/workflows/release-notes-preview.yml
+++ /dev/null
@@ -1,93 +0,0 @@
-name: Release Notes Preview
-run-name: Preview ${{ inputs.version }} release notes
-
-on:
- workflow_dispatch:
- inputs:
- version:
- description: 'Metabase version (e.g. v0.46.3)'
- type: string
- required: true
- slackChannel:
- description: 'Optional Slack channel to upload the markdown to (e.g. writing). When unset, the markdown is only available as a workflow artifact.'
- type: string
- required: false
- default: ''
-
-jobs:
- preview-release-notes:
- # Only generate release notes preview in https://github.com/metabase/metabase since this is the only place milestones are used which is
- # what we use to determine what issues/prs should be included in the release.
- if: github.repository == 'metabase/metabase'
- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
- timeout-minutes: 5
- steps:
- - name: Fail early on the incorrect version format
- if: ${{ !(startsWith(inputs.version,'v0.') || startsWith(inputs.version,'v1.')) }}
- run: |
- echo "The version format is invalid!"
- echo "It must start with either 'v0.' or 'v1.'."
- echo "Please, try again."
- exit 1
- - uses: actions/checkout@v7
- with:
- sparse-checkout: |
- release
- .github
- - name: Prepare release scripts
- uses: ./.github/actions/prepare-release-scripts
- - name: Get Release Version
- uses: actions/github-script@v9
- env:
- # required by getMilestoneIssues to configure GraphQL client
- GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- DOCKERHUB_OWNER: test_owner
- DOCKERHUB_REPO: test_repo
- AWS_S3_DOWNLOADS_BUCKET: test_bucket
- with:
- script: | # js
- const R = require('${{ github.workspace }}/release/dist/index.cjs');
- const fs = require('fs');
-
- const version = '${{ inputs.version }}';
-
- const issues = await R.getMilestoneIssues({
- version,
- github,
- owner: context.repo.owner,
- repo: context.repo.repo,
- });
-
- const notes = R.getWebsiteChangelog({
- version,
- issues,
- });
-
- fs.writeFileSync(`release-notes-preview-${version}.md`, notes);
- - name: Upload Release Notes
- uses: actions/upload-artifact@v7
- with:
- name: release-notes-preview-${{inputs.version}}.md
- path: |
- ${{ github.workspace }}/release-notes-preview-*.md
-
- - name: Post release notes preview to Slack
- if: ${{ inputs.slackChannel != '' }}
- uses: actions/github-script@v9
- env:
- SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- with:
- script: | # js
- const fs = require('fs');
- const { uploadFileToSlack } = require('${{ github.workspace }}/release/dist/index.cjs');
-
- const version = '${{ inputs.version }}';
- const fileName = `release-notes-preview-${version}.md`;
- const file = fs.readFileSync(`${{ github.workspace }}/${fileName}`);
-
- await uploadFileToSlack({
- channelName: '${{ inputs.slackChannel }}',
- fileName,
- file,
- message: `:page_with_curl: Release notes preview for *${version}* — ready for editing.`,
- });
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 4fa3f58eb22..0bbe661491b 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -591,37 +591,17 @@ jobs:
uses: ./.github/actions/prepare-release-scripts
- name: Publish draft release notes to github
uses: actions/github-script@v9
- env:
- # required by getMilestoneIssues to configure GraphQL client
- GITHUB_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
with:
github-token: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
result-encoding: string
script: | # js
- const {
- publishRelease,
- getCanonicalVersion,
- getGenericVersion,
- getMilestoneIssues,
- getWebsiteChangelog,
- getMajorVersion
- } = require('${{ github.workspace }}/release/dist/index.cjs');
-
- const version = '${{ inputs.version }}';
-
- const issues = await getMilestoneIssues({
- version,
- github,
- owner: context.repo.owner,
- repo: context.repo.repo,
- });
+ const { publishRelease } = require('${{ github.workspace }}/release/dist/index.cjs');
- // github releases page
await publishRelease({
github,
owner: context.repo.owner,
repo: context.repo.repo,
- version,
+ version: '${{ inputs.version }}',
}).then(() => {
console.log('Successfully published release notes', '${{ inputs.version }}');
}).catch((err) => {
@@ -629,20 +609,6 @@ jobs:
process.exit(1);
});
- // website changelog
- const changelogText = getWebsiteChangelog({ version, issues });
-
- await github.rest.repos.createDispatchEvent({
- owner: context.repo.owner,
- repo: '${{ vars.WEBSITE_REPO }}',
- event_type: 'update-changelog',
- client_payload: {
- version: getGenericVersion(version),
- majorVersion: getMajorVersion(version),
- text: changelogText,
- }
- }).catch(console.warn);
-
publish-version-info:
if: ${{ needs.check-version.outputs.kind == 'minor' || needs.check-version.outputs.kind == 'major' }}
runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}
diff --git a/.github/workflows/set-milestone.yml b/.github/workflows/set-milestone.yml
index 9134a921093..5aec98ca7d0 100644
--- a/.github/workflows/set-milestone.yml
+++ b/.github/workflows/set-milestone.yml
@@ -117,17 +117,3 @@ jobs:
commitMessages: commitMessages,
ignoreExistingMilestones: true,
});
-
- # Fresh-cut only: now that the milestone is populated, dispatch
- # release-notes-preview to post the markdown to #writing.
- # Manual workflow_dispatch backfills skip this — they're for catching
- # missed commits, not for pinging writers again.
- - name: Trigger release notes preview for the writing team
- if: ${{ github.event_name == 'push' && github.event.created == true }}
- env:
- GH_TOKEN: ${{ secrets.METABASE_AUTOMATION_USER_TOKEN }}
- run: |
- gh workflow run release-notes-preview.yml \
- -f version=v0.${{ steps.version.outputs.major }}.0 \
- -f slackChannel=writing \
- --repo "${{ github.repository }}"
diff --git a/.github/workflows/tag-for-release.yml b/.github/workflows/tag-for-release.yml
index 289e5579fc4..798655a7a81 100644
--- a/.github/workflows/tag-for-release.yml
+++ b/.github/workflows/tag-for-release.yml
@@ -162,33 +162,13 @@ jobs:
|| (echo "Commit not found in correct release branch" && exit 1)
git checkout -
- trigger-milestone-check:
- # Posts a Slack FYI about issues that still need review for this release.
- # Informational only — nothing depends on it, so it never blocks the release.
- #
- # NOTE: this workflow only runs in https://github.com/metabase/metabase.
- needs: [check-version, check-commit]
- permissions:
- contents: read
- issues: read
- uses: ./.github/workflows/release-milestone-check.yml
- secrets: inherit
- with:
- version: ${{ inputs.version }}
- commit: ${{ inputs.commit }}
-
manage-milestones:
# Close the milestone we're about to ship and open the next one BEFORE tagging,
# so any PRs that merge while the release is in flight are tagged with the next
# milestone (not the one about to be released).
#
- # Sequenced after trigger-milestone-check so that the check sees the milestone
- # in its open state. milestone-check is informational and must never block, so
- # we run regardless of its outcome; only preflight failures suppress this.
- #
# NOTE: this workflow only runs in https://github.com/metabase/metabase.
- needs: [check-version, check-commit, trigger-milestone-check]
- if: ${{ !cancelled() && needs.check-version.result == 'success' && needs.check-commit.result == 'success' }}
+ needs: [check-version, check-commit]
permissions:
contents: read
issues: write
diff --git a/release/bun.lock b/release/bun.lock
index b1f44843b6e..5786f46806a 100644
--- a/release/bun.lock
+++ b/release/bun.lock
@@ -5,7 +5,6 @@
"": {
"name": "release-helper",
"dependencies": {
- "@octokit/plugin-paginate-graphql": "^6.0.0",
"@octokit/rest": "^21.1.1",
"@slack/web-api": "^8.0.0",
"dayjs": "^1.11.20",
@@ -13,7 +12,6 @@
"esbuild": "^0.28.1",
"node-fetch": "^3.3.2",
"semver": "^7.8.0",
- "ts-pattern": "^5.9.0",
"typescript": "^5.9.3",
"zx": "^8.8.5",
},
@@ -365,8 +363,6 @@
"@octokit/openapi-types": ["@octokit/[email protected]", "", {}, "sha512-FZvktFu7HfOIJf2BScLKIEYjDsw6RKc7rBJCdvCTfKsVnx2GEB/Nbzjr29DUdb7vQhlzS/j8qDzdditP0OC6aw=="],
- "@octokit/plugin-paginate-graphql": ["@octokit/[email protected]", "", { "peerDependencies": { "@octokit/core": ">=6" } }, "sha512-crfpnIoFiBtRkvPqOyLOsw12XsveYuY2ieP6uYDosoUegBJpSVxGwut9sxUgFFcll3VTOTqpUf8yGd8x1OmAkQ=="],
-
"@octokit/plugin-paginate-rest": ["@octokit/[email protected]", "", { "dependencies": { "@octokit/types": "^13.10.0" } }, "sha512-n5KPteiF7pWKgBIBJSk8qzoZWcUkza2O6A0za97pMGVrGfPdltxrfmfF5GucHYvHGZD8BdaZmmHGz5cX/3gdpw=="],
"@octokit/plugin-request-log": ["@octokit/[email protected]", "", {}, "sha512-n/lNeCtq+9ofhC15xzmJCNKP2BWTv8Ih2TTy+jatNCCq/gQP/V7rK3fjIfuz0pDWDALO/o/4QY4hyOF6TQQFUw=="],
@@ -873,8 +869,6 @@
"to-regex-range": ["[email protected]", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="],
- "ts-pattern": ["[email protected]", "", {}, "sha512-6s5V71mX8qBUmlgbrfL33xDUwO0fq48rxAu2LBE11WBeGdpCPOsXksQbZJHvHwhrd3QjUusd3mAOM5Gg0mFBLg=="],
-
"type-detect": ["[email protected]", "", {}, "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="],
"type-fest": ["[email protected]", "", {}, "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="],
diff --git a/release/ci-conductor/package.json b/release/ci-conductor/package.json
index 0f8d7589529..9d770375628 100644
--- a/release/ci-conductor/package.json
+++ b/release/ci-conductor/package.json
@@ -1,15 +1,15 @@
{
"name": "ci-conductor",
"version": "1.0.0",
+ "private": true,
"description": "Shared CI Conductor test-failure reporting. Adapter pattern: each test suite (be/fe/e2e) transforms its source data into one canonical shape, and the shared core posts it to ci-conductor. This round ships the backend (JUnit) adapter + the /webhooks/failed-tests transport.",
+ "license": "AGPL-3.0-or-later",
+ "author": "Metabase",
"type": "module",
- "private": true,
"scripts": {
"test": "bun test",
"type-check": "tsc --noEmit"
},
- "author": "Metabase",
- "license": "AGPL-3.0-or-later",
"devDependencies": {
"@types/bun": "^1.3.14",
"@types/node": "^22.10.0",
diff --git a/release/generate-changelog.ts b/release/generate-changelog.ts
deleted file mode 100644
index 6c3d2614618..00000000000
--- a/release/generate-changelog.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-// changelog preview only, doesn't publish anything
-import { Octokit } from "@octokit/rest";
-
-import { getChangelog, isValidVersionString } from "./src";
-
-const { GITHUB_TOKEN, GITHUB_OWNER, GITHUB_REPO } = process.env as any;
-
-if (!GITHUB_TOKEN || !GITHUB_OWNER || !GITHUB_REPO) {
- console.error(
- "You must provide GITHUB_* environment variables in .env-template",
- );
-}
-
-const github = new Octokit({ auth: GITHUB_TOKEN });
-
-const version = process.argv?.[2]?.trim();
-
-if (!isValidVersionString(version)) {
- console.error(
- "You must provide a valid version string as the first argument (e.g v0.45.6)",
- );
-}
-
-const notes = await getChangelog({
- version,
- github,
- owner: GITHUB_OWNER,
- repo: GITHUB_REPO,
-});
-
-console.log(notes);
diff --git a/release/package.json b/release/package.json
index c69fe4d1b3d..47d2c359e2e 100644
--- a/release/package.json
+++ b/release/package.json
@@ -2,14 +2,12 @@
"name": "release-helper",
"version": "1.0.0",
"description": "",
+ "license": "AGPL-3.0-or-later",
+ "author": "Metabase",
"type": "module",
"main": "run/build.js",
- "engines": {
- "node": ">=18.0.0"
- },
"scripts": {
"build": "esbuild src/index.ts --bundle --outfile=dist/index.cjs --platform=node --target=node16",
- "generate-changelog": "bun generate-changelog.ts",
"alert-upgrade-versions": "bun alert-upgrade-versions.ts",
"docker-readme": "bun docker-readme.ts",
"format": "oxfmt --write",
@@ -18,10 +16,7 @@
"test:integration": "jest --testPathPattern integration",
"type-check": "tsc --noEmit"
},
- "author": "Metabase",
- "license": "AGPL-3.0-or-later",
"dependencies": {
- "@octokit/plugin-paginate-graphql": "^6.0.0",
"@octokit/rest": "^21.1.1",
"@slack/web-api": "^8.0.0",
"dayjs": "^1.11.20",
@@ -29,7 +24,6 @@
"esbuild": "^0.28.1",
"node-fetch": "^3.3.2",
"semver": "^7.8.0",
- "ts-pattern": "^5.9.0",
"typescript": "^5.9.3",
"zx": "^8.8.5"
},
@@ -41,5 +35,8 @@
"@types/semver": "^7.7.1",
"jest": "^29.7.0",
"oxfmt": "^0.38.0"
+ },
+ "engines": {
+ "node": ">=18.0.0"
}
}
diff --git a/release/src/constants.ts b/release/src/constants.ts
deleted file mode 100644
index 04ba9ba1273..00000000000
--- a/release/src/constants.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export const nonUserFacingLabels = [".CI & Tests", ".Building & Releasing"];
-
-export const hiddenLabels = ["no-release-notes", "Type:Documentation"];
diff --git a/release/src/github.ts b/release/src/github.ts
index ed93d6aa37e..abe0b93fb25 100644
--- a/release/src/github.ts
+++ b/release/src/github.ts
@@ -1,6 +1,3 @@
-import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";
-import { Octokit } from "@octokit/rest";
-
import type { GithubCheck, GithubProps, Issue, ReleaseProps } from "./types";
import {
getLastReleaseTag,
@@ -11,66 +8,6 @@ import {
type MilestoneState = "open" | "closed" | "all";
-const PaginatingOctokit = Octokit.plugin(paginateGraphQL);
-
-type MilestoneItemNode = {
- number: number;
- id: string;
- title: string;
- body: string | null;
- url: string;
- createdAt: string;
- labels: { nodes: { name: string }[] };
- assignees: { nodes: { login: string }[] };
-};
-
-const getMilestoneItems = async ({
- owner,
- repo,
- milestoneNumber,
- connection,
- states,
-}: {
- owner: string;
- repo: string;
- milestoneNumber: number;
- connection: "issues" | "pullRequests";
- states: string[];
-}): Promise<MilestoneItemNode[]> => {
- // The octokit injected by actions/github-script lacks the paginate-graphql
- // plugin, so build our own plugin-enabled client from the token in env
- const client = new PaginatingOctokit({ auth: process.env.GITHUB_TOKEN });
- const stateType =
- connection === "pullRequests" ? "PullRequestState" : "IssueState";
-
- const { repository } = await client.graphql.paginate<{
- repository: { milestone: Record<string, { nodes: MilestoneItemNode[] }> };
- }>(
- `query paginate($cursor: String, $owner: String!, $repo: String!, $num: Int!, $states: [${stateType}!]) {
- repository(owner: $owner, name: $repo) {
- milestone(number: $num) {
- ${connection}(first: 100, after: $cursor, states: $states) {
- pageInfo { hasNextPage endCursor }
- nodes {
- number
- id
- title
- body
- url
- createdAt
- labels(first: 50) { nodes { name } }
- assignees(first: 1) { nodes { login } }
- }
- }
- }
- }
- }`,
- { owner, repo, num: milestoneNumber, states },
- );
-
- return repository.milestone[connection].nodes;
-};
-
export const getMilestones = async ({
github,
owner,
@@ -146,71 +83,6 @@ export const openNextMilestones = async ({
);
};
-export const getMilestoneIssues = async ({
- version,
- github,
- owner,
- repo,
- state = "closed",
- milestoneStatus,
-}: ReleaseProps & {
- state?: "closed" | "open";
- milestoneStatus?: MilestoneState;
-}): Promise<Issue[]> => {
- const milestone = await findMilestone({
- version,
- github,
- owner,
- repo,
- state: milestoneStatus,
- });
-
- if (!milestone) {
- return [];
- }
-
- const issueStates = state === "closed" ? ["CLOSED"] : ["OPEN"];
- const prStates = state === "closed" ? ["MERGED", "CLOSED"] : ["OPEN"];
-
- const [issueNodes, prNodes] = await Promise.all([
- getMilestoneItems({
- owner,
- repo,
- milestoneNumber: milestone.number,
- connection: "issues",
- states: issueStates,
- }),
- getMilestoneItems({
- owner,
- repo,
- milestoneNumber: milestone.number,
- connection: "pullRequests",
- states: prStates,
- }),
- ]);
-
- // map results of getMilestoneItems to Issue type
- const toIssue = (n: MilestoneItemNode, isPR: boolean): Issue => ({
- number: n.number,
- node_id: n.id,
- title: n.title,
- html_url: n.url,
- body: n.body ?? "",
- pull_request: isPR ? { html_url: n.url } : undefined,
- milestone,
- labels: n.labels.nodes.map((l) => ({ name: l.name })),
- assignee: n.assignees.nodes[0]
- ? { login: n.assignees.nodes[0].login }
- : null,
- created_at: n.createdAt,
- });
-
- return [
- ...issueNodes.map((n) => toIssue(n, false)),
- ...prNodes.map((n) => toIssue(n, true)),
- ];
-};
-
export const hasBeenReleased = async ({
github,
owner,
diff --git a/release/src/milestones.ts b/release/src/milestones.ts
index 20fbac9719c..07d63a21d2e 100644
--- a/release/src/milestones.ts
+++ b/release/src/milestones.ts
@@ -1,33 +1,14 @@
-import fs from "fs";
-
-import { graphql } from "@octokit/graphql";
-
-import { hiddenLabels, nonUserFacingLabels } from "./constants";
-import {
- findMilestone,
- getIssueWithCache,
- getMilestoneIssues,
- getMilestones,
-} from "./github";
+import { getIssueWithCache, getMilestones } from "./github";
import {
getBackportSourcePRNumber,
getLinkedIssues,
getPRsFromCommitMessage,
} from "./linked-issues";
-import type {
- Commit,
- GithubProps,
- Issue,
- Milestone,
- ReleaseProps,
-} from "./types";
+import type { GithubProps, Issue, Milestone } from "./types";
import {
- getLastReleaseTag,
getMajorVersion,
getVersionFromReleaseBranch,
ignorePatches,
- isPatchVersion,
- isPreReleaseVersion,
versionSort,
} from "./version-helpers";
@@ -47,89 +28,6 @@ function hasLabel(issue: Issue, labelName: string) {
const isNotNull = <T>(value: T | null): value is T => value !== null;
-const excludedLabels = [
- ...nonUserFacingLabels,
- ...hiddenLabels,
- ".Already Fixed",
-];
-
-function getExcludedLabels(issue: Issue) {
- if (!Array.isArray(issue.labels)) {
- return [];
- }
- return issue.labels?.filter(
- (label) => label.name && excludedLabels.includes(label.name),
- );
-}
-
-function shouldExcludeIssueFromMilestone(issue: Issue) {
- return !!getExcludedLabels(issue).length;
-}
-
-async function getIssuesWithExcludedTags({
- github,
- owner,
- repo,
- issueNumbers,
-}: GithubProps & { issueNumbers: number[] }) {
- const issues = await Promise.all(
- issueNumbers.map((issueNumber) =>
- getIssueWithCache({
- github,
- owner,
- repo,
- issueNumber,
- }),
- ),
- );
-
- return new Set(
- issues
- .filter(isNotNull)
- .filter((issue) => shouldExcludeIssueFromMilestone(issue))
- .map((issue) => issue.number),
- );
-}
-
-async function getIssuesWithOlderMilestones({
- github,
- owner,
- repo,
- issueNumbers,
- releaseMilestone,
-}: GithubProps & { issueNumbers: number[]; releaseMilestone: Milestone }) {
- const issues = await Promise.all(
- issueNumbers.map((issueNumber) =>
- getIssueWithCache({
- github,
- owner,
- repo,
- issueNumber,
- }),
- ),
- );
-
- return new Set(
- issues
- .filter(isNotNull)
- .filter((issue) => {
- if (
- issue.milestone &&
- versionSort(issue.milestone.title, releaseMilestone.title) < 0
- ) {
- console.log(
- ` Issue #${issue.number} is in an older milestone`,
- issue.milestone.title,
- );
- return true;
- }
-
- return false;
- })
- .map((issue) => issue.number),
- );
-}
-
async function getOriginalIssues({
github,
repo,
@@ -342,391 +240,6 @@ export async function setMilestoneForCommits({
}
}
-const issueLink = ({
- owner,
- repo,
- issueNumber,
-}: {
- owner: string;
- repo: string;
- issueNumber: number;
-}) => `https://github.com/${owner}/${repo}/issues/${issueNumber}`;
-
-export async function checkMilestoneForRelease({
- github,
- owner,
- repo,
- version,
- commitHash,
-}: GithubProps & { version: string; commitHash: string }) {
- // Nothing to audit pre-release, for two reasons:
- // - Patches don't have their own milestone — they share the parent minor's.
- // - A major's `.0` is, by convention, only ever cut as a pre-release
- // (beta/RC); we never tag a `.0` as a standalone stable build. So a
- // pre-release is always the first build of a new major and has no prior
- // stable release *in the same major* to diff against — and we never
- // compare across majors.
- // Bail here so we skip the milestone API calls entirely (and never compare
- // against an `undefined` base ref).
- if (isPatchVersion(version) || isPreReleaseVersion(version)) {
- console.log(`Skipping milestone check for ${version}`);
- return;
- }
-
- const lastTag = await getLastReleaseTag({
- github,
- owner,
- repo,
- version,
- ignorePatches: true, // ignore patch versions since we don't release notes for them
- ignorePreReleases: true, // ignore pre-releases because we want cumulative notes for them
- });
-
- // Safety net: by convention, a `.0` should never be a standalone release.
- // If someone breaks that, this check exits early.
- if (!lastTag) {
- console.log(
- `No prior release tag found for ${version}, skipping milestone check`,
- );
- return;
- }
-
- const releaseMilestone = await findMilestone({
- github,
- owner,
- repo,
- version,
- });
-
- if (!releaseMilestone) {
- throw new Error(`No open milestone found for ${version}`);
- }
-
- const closedMilestoneIssues = await getMilestoneIssues({
- github,
- owner,
- repo,
- version,
- state: "closed",
- milestoneStatus: "open",
- });
- const openMilestoneIssues = await getMilestoneIssues({
- github,
- owner,
- repo,
- version,
- state: "open",
- milestoneStatus: "open",
- });
-
- const compareResponse = await github.rest.repos.compareCommitsWithBasehead({
- owner,
- repo,
- basehead: `${lastTag}...${commitHash}`,
- });
-
- const commits = compareResponse.data.commits;
-
- console.log(`Found ${commits.length} commits in release branch`);
- console.log(`Found ${closedMilestoneIssues.length} issues in milestone`);
-
- const milestoneIssueSet = new Set(
- closedMilestoneIssues.map((issue) => issue.number),
- );
- const commitIssueSet = new Set<number>();
-
- // make sure every commit in the release branch has a corresponding issue in the milestone
- const commitIssueMap: Record<string, number[]> = {};
- const issueCommitMap: Record<number, string> = {};
-
- for (const commit of commits) {
- const prNumbers = getPRsFromCommitMessage(commit.commit.message);
- if (!prNumbers) {
- console.log("No PRs found in commit message", commit.commit.message);
- continue;
- }
-
- const issueNumbers: number[] = [];
-
- for (const prNumber of prNumbers) {
- if (issueNumbers.includes(prNumber)) {
- continue;
- }
- issueNumbers.push(
- ...(await getOriginalIssues({
- github,
- owner,
- repo,
- issueNumber: prNumber,
- })),
- );
- }
-
- const uniqueIssues = uniq(issueNumbers.filter(isNotNull));
- commitIssueMap[commit.sha] = uniqueIssues;
-
- uniqueIssues.forEach((issueNumber) => {
- commitIssueSet.add(issueNumber);
- issueCommitMap[issueNumber] = commit.sha;
- });
- }
-
- const allIssueNumbers = Array.from(commitIssueSet).concat(
- Array.from(milestoneIssueSet),
- );
-
- const issuesInOlderMilestones = await getIssuesWithOlderMilestones({
- github,
- owner,
- repo,
- issueNumbers: allIssueNumbers,
- releaseMilestone,
- });
-
- const issuesWithExcludedTags = await getIssuesWithExcludedTags({
- github,
- owner,
- repo,
- issueNumbers: allIssueNumbers,
- });
-
- const issuesInMilestoneNotInCommits = closedMilestoneIssues.filter(
- (issue) =>
- !commitIssueSet.has(issue.number) &&
- !issuesWithExcludedTags.has(issue.number) &&
- !issuesInOlderMilestones.has(issue.number),
- );
-
- const issuesInCommitsNotInMilestone = Array.from(commitIssueSet).filter(
- (issueNumber) =>
- !milestoneIssueSet.has(issueNumber) &&
- !issuesInOlderMilestones.has(issueNumber) &&
- !issuesWithExcludedTags.has(issueNumber),
- );
-
- for (const issue of issuesInMilestoneNotInCommits) {
- await addIssueToProject({
- github,
- owner,
- repo,
- issueNumber: issue.number,
- version,
- comment: "Issue in milestone, cannot find commit",
- }).catch((e) =>
- console.error(`error adding issue ${issue.number} to project`, e),
- );
- }
-
- for (const issueNumber of issuesInCommitsNotInMilestone) {
- await addIssueToProject({
- github,
- owner,
- repo,
- issueNumber: issueNumber,
- version,
- comment: "Issue in release branch, needs milestone",
- }).catch((e) =>
- console.error(`error adding issue ${issueNumber} to project`, e),
- );
- }
-
- for (const issue of openMilestoneIssues) {
- await addIssueToProject({
- github,
- owner,
- repo,
- issueNumber: issue.number,
- version,
- comment: "Issue still open in milestone",
- }).catch((e) =>
- console.error(`error adding issue ${issue.number} to project`, e),
- );
- }
-
- const logText = await generateLog({
- github,
- owner,
- repo,
- version,
- commits: commits,
- lastTag,
- commitHash,
- issuesInMilestoneNotInCommits,
- issuesInCommitsNotInMilestone,
- issuesWithExcludedTags,
- issuesInOlderMilestones,
- milestoneIssueSet,
- openMilestoneIssues,
- commitIssueMap,
- });
-
- fs.writeFileSync(`milestone-audit-${version}.md`, logText);
-
- const issuesNeedingAttentionCount =
- openMilestoneIssues.length +
- issuesInMilestoneNotInCommits.length +
- issuesInCommitsNotInMilestone.length;
-
- return issuesNeedingAttentionCount;
-}
-
-async function generateLog({
- github,
- owner,
- repo,
- commits,
- version,
- lastTag,
- commitHash,
- issuesInMilestoneNotInCommits,
- issuesInCommitsNotInMilestone,
- issuesWithExcludedTags,
- issuesInOlderMilestones,
- milestoneIssueSet,
- openMilestoneIssues,
- commitIssueMap,
-}: ReleaseProps & {
- commits: Commit[];
- lastTag: string;
- commitHash: string;
- issuesInMilestoneNotInCommits: Issue[];
- issuesInCommitsNotInMilestone: number[];
- issuesWithExcludedTags: Set<number>;
- issuesInOlderMilestones: Set<number>;
- milestoneIssueSet: Set<number>;
- openMilestoneIssues: Issue[];
- commitIssueMap: Record<string, number[]>;
-}) {
- let log = `# ${version} Milestone Audit Log\n\n`;
-
- log += `Parsing from ${lastTag} to ${commitHash} \n`;
-
- log += "## Summary:\n";
-
- log +=
- "\n‼️ Closed Issues in milestone but not in commits:" +
- issuesInMilestoneNotInCommits
- .map(
- (issue) =>
- `\n #${issue.number} (${issueLink({ owner, repo, issueNumber: issue.number })})`,
- )
- .join("");
-
- log +=
- "\n‼️ Issues in commits but not in milestone:" +
- issuesInCommitsNotInMilestone
- .map(
- (issueNumber) =>
- `\n #${issueNumber} (${issueLink({ owner, repo, issueNumber })})`,
- )
- .join("");
-
- log +=
- "\n‼️ Open issues in milestone:" +
- openMilestoneIssues
- .map(
- (issue) =>
- `\n #${issue.number} (${issueLink({ owner, repo, issueNumber: issue.number })})`,
- )
- .join("");
-
- log += "\n\n## Commits in release branch\n";
-
- for (const hash in commitIssueMap) {
- const msg = commits.find((commit) => commit.sha === hash)?.commit.message;
- log += `\n➡️ ${msg?.split("\n")[0]} [${hash.slice(0, 7)}]\n`;
-
- for (const issueNumber of commitIssueMap[hash]) {
- if (milestoneIssueSet.has(issueNumber)) {
- log += ` ✅ Issue #${issueNumber} is in milestone\n`;
- } else if (issuesInOlderMilestones.has(issueNumber)) {
- log += ` ✅ Issue #${issueNumber} is in an older milestone\n`;
- } else if (issuesWithExcludedTags.has(issueNumber)) {
- const issue = await getIssueWithCache({
- github,
- owner,
- repo,
- issueNumber,
- });
- const excludedTags = issue ? getExcludedLabels(issue) : [];
- log += ` ✅ Issue #${issueNumber} has excluded tags: ${excludedTags.map((l) => l.name).join(",")}\n`;
- } else {
- log += ` ❌ Issue #${issueNumber} is not in milestone, but probably should be (${issueLink({ owner, repo, issueNumber })})\n`;
- }
- }
- }
-
- return log;
-}
-
-const releaseIssueProject = {
- id: "PVT_kwDOAKCINc4Ajw5A",
- commentColId: "PVTF_lADOAKCINc4Ajw5AzgcE7NA",
- versionColId: "PVTF_lADOAKCINc4Ajw5AzgcE7PY",
-};
-
-async function addIssueToProject({
- github,
- owner,
- repo,
- issueNumber,
- comment,
- version,
-}: GithubProps & { issueNumber: number; comment: string; version: string }) {
- console.log(`Possible problem issue: #${issueNumber} - ${comment}`);
-
- const issue = await getIssueWithCache({
- github,
- owner,
- repo,
- issueNumber,
- });
-
- if (!issue) {
- console.log(`Issue ${issueNumber} not found`);
- return;
- }
-
- const graphqlWithAuth = graphql.defaults({
- headers: {
- authorization: `token ${process.env.GITHUB_TOKEN}`,
- },
- });
-
- const response = (await graphqlWithAuth(`mutation {
- addProjectV2ItemById(input: {
- projectId: "${releaseIssueProject.id}",
- contentId: "${issue?.node_id}"
- })
- { item { id } }
- }`)) as { addProjectV2ItemById: { item: { id: string } } };
-
- const itemId = response.addProjectV2ItemById.item.id;
-
- if (!itemId) {
- console.log(`Failed to add issue ${issueNumber} to project`);
- return;
- }
-
- await graphqlWithAuth(`
- mutation {
- setComment: updateProjectV2ItemFieldValue( input: {
- projectId: "${releaseIssueProject.id}"
- itemId: "${itemId}"
- fieldId: "${releaseIssueProject.commentColId}"
- value: { text: "${comment}" } }
- )
- { projectV2Item { id } }
- setVersion: updateProjectV2ItemFieldValue( input: {
- projectId: "${releaseIssueProject.id}"
- itemId: "${itemId}"
- fieldId: "${releaseIssueProject.versionColId}"
- value: { text: "${version}" } }
- )
- { projectV2Item { id } }
- }`);
-}
-
function uniq<T>(array: T[]) {
return Array.from<T>(new Set(array));
}
diff --git a/release/src/milestones.unit.spec.ts b/release/src/milestones.unit.spec.ts
index c172bceeb70..e1739b60508 100644
--- a/release/src/milestones.unit.spec.ts
+++ b/release/src/milestones.unit.spec.ts
@@ -1,8 +1,4 @@
-import {
- checkMilestoneForRelease,
- getNextMilestone,
- setMilestoneForCommits,
-} from "./milestones";
+import { getNextMilestone, setMilestoneForCommits } from "./milestones";
import type { Milestone } from "./types";
describe("milestones", () => {
@@ -120,84 +116,4 @@ describe("milestones", () => {
expect(github.rest.issues.update).not.toHaveBeenCalled();
});
});
-
- describe("checkMilestoneForRelease", () => {
- // string sentinels so paginate can dispatch on which rest endpoint it got
- const listMilestones = "listMilestones";
- const listForRepo = "listForRepo";
- const listMatchingRefs = "listMatchingRefs";
-
- const buildGithub = ({
- milestones = [{ number: 620, title: "0.62" }] as Milestone[],
- tags = [] as { ref: string }[],
- } = {}) => {
- const rest = {
- issues: { listMilestones, listForRepo },
- git: { listMatchingRefs },
- repos: { compareCommitsWithBasehead: jest.fn() },
- };
- const paginate = jest.fn((fn: unknown) => {
- if (fn === listMilestones) return Promise.resolve(milestones);
- if (fn === listMatchingRefs) return Promise.resolve(tags);
- return Promise.resolve([]); // listForRepo -> no milestone issues
- });
- return { paginate, rest };
- };
-
- it("is a no-op for a pre-release, bailing before any API calls (a major .0 is always cut as a beta/RC)", async () => {
- const github = buildGithub();
-
- await expect(
- checkMilestoneForRelease({
- github: github as any,
- owner: "metabase",
- repo: "metabase",
- version: "v0.62.0-beta",
- commitHash: "b36890cda1b4bd8009b3c416c071937273fe87dc",
- }),
- ).resolves.toBeUndefined();
-
- // never attempt the compare with an `undefined` base ref
- expect(
- github.rest.repos.compareCommitsWithBasehead,
- ).not.toHaveBeenCalled();
- // and bail before touching the API at all — not even the tag list
- expect(github.paginate).not.toHaveBeenCalled();
- });
-
- it("safety net: skips when there is no prior stable tag in this major, without comparing against `undefined`", async () => {
- // A stable .0 shouldn't happen by convention, but if one ever reaches
- // here, getLastReleaseTag finds no stable base and we must not feed
- // `undefined` into the compare API.
- const github = buildGithub({
- tags: [
- { ref: "refs/tags/v0.62.0-beta" },
- { ref: "refs/tags/v0.62.0-RC1" },
- ],
- });
-
- await expect(
- checkMilestoneForRelease({
- github: github as any,
- owner: "metabase",
- repo: "metabase",
- version: "v0.62.0",
- commitHash: "b36890cda1b4bd8009b3c416c071937273fe87dc",
- }),
- ).resolves.toBeUndefined();
-
- expect(
- github.rest.repos.compareCommitsWithBasehead,
- ).not.toHaveBeenCalled();
- // only the tag list was queried, then we bailed before milestone lookups
- expect(github.paginate).toHaveBeenCalledWith(
- listMatchingRefs,
- expect.anything(),
- );
- expect(github.paginate).not.toHaveBeenCalledWith(
- listMilestones,
- expect.anything(),
- );
- });
- });
});
diff --git a/release/src/release-notes-templates.ts b/release/src/release-notes-templates.ts
index 99e0d2bb8ef..3a436439238 100644
--- a/release/src/release-notes-templates.ts
+++ b/release/src/release-notes-templates.ts
@@ -21,38 +21,3 @@ JAR download: {{ee-download-url}}
[Full Changelog]({{changelog-url}})
`;
-
-export const websiteChangelogTemplate = `
-## Metabase {{version}}
-
-### Upgrading | {{generic-version}}
-
-#### Metabase Open Source | {{generic-version}}
-
-- Docker image: {{oss-docker-tag}}
-- [JAR download]({{oss-download-url}})
-
-#### Metabase Enterprise | {{generic-version}}
-
-- Docker image: {{ee-docker-tag}}
-- [JAR download]({{ee-download-url}})
-
-### Enhancements | {{generic-version}}
-
-{{enhancements}}
-
-### Bug fixes | {{generic-version}}
-
-{{bug-fixes}}
-
-### Already Fixed | {{generic-version}}
-
-Issues confirmed to have been fixed in a previous release.
-
-{{already-fixed}}
-
-### Under the Hood | {{generic-version}}
-
-{{under-the-hood}}
-
-`;
diff --git a/release/src/release-notes.ts b/release/src/release-notes.ts
index b4e9c06bb27..21816ab05fe 100644
--- a/release/src/release-notes.ts
+++ b/release/src/release-notes.ts
@@ -1,13 +1,5 @@
-import { match } from "ts-pattern";
-
-import { hiddenLabels, nonUserFacingLabels } from "./constants";
-import { getMilestoneIssues, hasBeenReleased } from "./github";
-import { issueNumberRegex } from "./linked-issues";
-import {
- githubReleaseTemplate,
- websiteChangelogTemplate,
-} from "./release-notes-templates";
-import type { Issue, ReleaseProps } from "./types";
+import { githubReleaseTemplate } from "./release-notes-templates";
+import type { ReleaseProps } from "./types";
import {
getDotXVersion,
getEnterpriseVersion,
@@ -20,32 +12,6 @@ import {
isValidVersionString,
} from "./version-helpers";
-const hasLabel = (issue: Issue, label: string) => {
- if (typeof issue.labels === "string") {
- return issue.labels.includes(label);
- }
- return issue.labels.some((tag) => tag.name === label);
-};
-
-const isBugIssue = (issue: Issue) => {
- return hasLabel(issue, "Type:Bug");
-};
-
-const isAlreadyFixedIssue = (issue: Issue) => {
- return hasLabel(issue, ".Already Fixed");
-};
-
-const isNonUserFacingIssue = (issue: Issue) => {
- return nonUserFacingLabels.some((label) => hasLabel(issue, label));
-};
-
-const isHiddenIssue = (issue: Issue) => {
- return hiddenLabels.some((label) => hasLabel(issue, label));
-};
-
-const formatIssue = (issue: Issue) =>
- `- ${issue.title.trim()} (#${issue.number})`;
-
export const getDockerTag = (version: string) => {
const dotXVersion = getDotXVersion(version);
@@ -74,174 +40,21 @@ export const getReleaseTitle = (version: string) => {
return `Metabase ${getGenericVersion(version)}`;
};
-enum IssueType {
- bugFixes = "bugFixes",
- enhancements = "enhancements",
- alreadyFixedIssues = "alreadyFixedIssues",
- underTheHoodIssues = "underTheHoodIssues",
-}
-
-const otherProductCategory = "Other";
-
-type ProductCategory =
- | "Administration"
- | "Database"
- | "Embedding"
- | "Operation"
- | "Organization"
- | "Querying"
- | "Reporting"
- | "Visualization"
- | "Other";
-
-// Map `Map<ProductCategory, LabelPart[]>`:
-// - `ProductCategory` is product categories in release notes
-// - `LabelPart` is PR/Issue labels parts that used to route issues to those categories
-// The item position in labels parts list determines the order in which these strings are tested against the actual label
-const productCategories: Record<ProductCategory, readonly string[]> = {
- Administration: ["Administration"],
- Database: ["Database"],
- Embedding: ["Embedding", "SDK"],
- Operation: ["Operation"],
- Organization: ["Organization"],
- Querying: ["Querying"],
- Reporting: ["Reporting"],
- Visualization: ["Visualization"],
- [otherProductCategory]: ["Other"],
-};
-
-type CategoryIssueMap = Record<Partial<ProductCategory>, Issue[]>;
-
-type IssueMap = {
- [IssueType.bugFixes]: CategoryIssueMap;
- [IssueType.enhancements]: CategoryIssueMap;
- [IssueType.alreadyFixedIssues]: CategoryIssueMap;
- [IssueType.underTheHoodIssues]: CategoryIssueMap;
-};
-
-const getIssueType = (issue: Issue): IssueType => {
- return match(issue)
- .when(isNonUserFacingIssue, () => IssueType.underTheHoodIssues)
- .when(isAlreadyFixedIssue, () => IssueType.alreadyFixedIssues)
- .when(isBugIssue, () => IssueType.bugFixes)
- .otherwise(() => IssueType.enhancements);
-};
-
-const getLabels = (issue: Issue): string[] => {
- if (typeof issue.labels === "string") {
- return issue.labels.split(",");
- }
- return issue.labels.map((label) => label.name || "");
-};
-
-const hasCategory = (issue: Issue, labelPart: string): boolean => {
- const labels = getLabels(issue);
- return labels.some((label) => label.includes(labelPart));
-};
-
-export const getProductCategory = (issue: Issue): ProductCategory => {
- for (const [productCategory, labelParts] of Object.entries(
- productCategories,
- )) {
- const isMatching = labelParts.some((labelPart) =>
- hasCategory(issue, labelPart),
- );
-
- if (isMatching) {
- return productCategory as ProductCategory;
- }
- }
-
- return otherProductCategory;
-};
-
-// Format issues for a single product category
-const formatIssueCategory = (
- categoryName: ProductCategory,
- issues: Issue[],
-): string => {
- return `**${categoryName}**\n\n${issues.map(formatIssue).join("\n")}`;
-};
-
-// We want to alphabetize the issues by product category, with "Other" (uncategorized) issues as the caboose
-const sortCategories = (categories: ProductCategory[]) => {
- const uncategorizedIssues = categories.filter(
- (category) => category === otherProductCategory,
- );
- const sortedCategories = categories
- .filter((cat) => cat !== otherProductCategory)
- .sort((a, b) => a.localeCompare(b));
-
- return [...sortedCategories, ...uncategorizedIssues];
-};
-
-// For each issue category ("Enhancements", "Bug Fixes", etc.), we want to group issues by product category
-const formatIssues = (issueMap: CategoryIssueMap): string => {
- const categories = sortCategories(Object.keys(issueMap) as ProductCategory[]);
-
- return categories
- .map((categoryName) =>
- formatIssueCategory(categoryName, issueMap[categoryName]),
- )
- .join("\n\n");
-};
-
-export const categorizeIssues = (issues: Issue[]) => {
- return issues
- .filter((issue) => !isHiddenIssue(issue))
- .reduce(
- (issueMap: IssueMap, issue: Issue) => {
- const issueType = getIssueType(issue);
- const productCategory = getProductCategory(issue);
-
- return {
- ...issueMap,
- [issueType]: {
- ...issueMap[issueType],
- [productCategory]: [
- ...(issueMap[issueType][productCategory] ?? []),
- issue,
- ],
- },
- };
- },
- {
- [IssueType.bugFixes]: {},
- [IssueType.enhancements]: {},
- [IssueType.alreadyFixedIssues]: {},
- [IssueType.underTheHoodIssues]: {},
- } as IssueMap,
- );
-};
-
export const generateReleaseNotes = ({
version,
- issues,
template,
}: {
version: string;
- issues: Issue[];
template: string;
}) => {
- const issuesByType = categorizeIssues(issues);
-
const ossVersion = getOSSVersion(version);
const eeVersion = getEnterpriseVersion(version);
return template
- .replace("{{version}}", getGenericVersion(version))
- .replace("{{enhancements}}", formatIssues(issuesByType.enhancements))
- .replace("{{bug-fixes}}", formatIssues(issuesByType.bugFixes))
- .replace("{{already-fixed}}", formatIssues(issuesByType.alreadyFixedIssues))
- .replace(
- "{{under-the-hood}}",
- formatIssues(issuesByType.underTheHoodIssues),
- )
.replace("{{ee-docker-tag}}", getDockerTag(eeVersion))
.replace("{{ee-download-url}}", getDownloadUrl(eeVersion))
.replace("{{oss-docker-tag}}", getDockerTag(ossVersion))
.replace("{{oss-download-url}}", getDownloadUrl(ossVersion))
- .replaceAll("{{generic-version}}", getGenericVersion(version))
.replace("{{changelog-url}}", getChangelogUrl(ossVersion));
};
@@ -261,7 +74,6 @@ export async function publishRelease({
name: getReleaseTitle(version),
body: generateReleaseNotes({
version,
- issues: [], // we don't actually post any issue data with this template
template: githubReleaseTemplate,
}),
draft: true,
@@ -270,67 +82,3 @@ export async function publishRelease({
return github.rest.repos.createRelease(payload);
}
-
-const issueLink = (issueNumber: string) =>
- `https://github.com/metabase/metabase/issues/${issueNumber}`;
-
-export function markdownIssueLinks(text: string) {
- return (
- text?.replaceAll(issueNumberRegex, (_, issueNumber) => {
- return `([#${issueNumber}](${issueLink(issueNumber)}))`;
- }) ??
- text ??
- ""
- );
-}
-
-export function getWebsiteChangelog({
- version,
- issues,
-}: {
- version: string;
- issues: Issue[];
-}) {
- if (!isValidVersionString(version)) {
- throw new Error(`Invalid version string: ${version}`);
- }
-
- const notes = generateReleaseNotes({
- version,
- issues,
- template: websiteChangelogTemplate,
- });
-
- return markdownIssueLinks(notes);
-}
-
-export async function getChangelog({
- version,
- owner,
- repo,
- github,
-}: ReleaseProps) {
- if (!isValidVersionString(version)) {
- throw new Error(`Invalid version string: ${version}`);
- }
- const isAlreadyReleased = await hasBeenReleased({
- github,
- owner,
- repo,
- version,
- });
-
- const issues = await getMilestoneIssues({
- version,
- github,
- owner,
- repo,
- milestoneStatus: isAlreadyReleased ? "closed" : "open",
- });
-
- return generateReleaseNotes({
- template: websiteChangelogTemplate,
- version,
- issues,
- });
-}
diff --git a/release/src/release-notes.unit.spec.ts b/release/src/release-notes.unit.spec.ts
index e9197d7eacc..6a2c4d576fb 100644
--- a/release/src/release-notes.unit.spec.ts
+++ b/release/src/release-notes.unit.spec.ts
@@ -1,16 +1,5 @@
-import {
- categorizeIssues,
- generateReleaseNotes,
- getChangelogUrl,
- getReleaseTitle,
- getWebsiteChangelog,
- markdownIssueLinks,
-} from "./release-notes";
-import {
- githubReleaseTemplate,
- websiteChangelogTemplate,
-} from "./release-notes-templates";
-import type { Issue } from "./types";
+import { generateReleaseNotes, getReleaseTitle } from "./release-notes";
+import { githubReleaseTemplate } from "./release-notes-templates";
describe("Release Notes", () => {
beforeEach(() => {
@@ -29,102 +18,10 @@ describe("Release Notes", () => {
});
describe("generateReleaseNotes", () => {
- const issues = [
- {
- number: 1,
- title: "Bug Issue",
- labels: [{ name: "Type:Bug" }, { name: "Embedding/Interactive" }],
- },
- {
- number: 2,
- title: "Feature Issue",
- labels: [{ name: "Querying/MBQL" }],
- },
- {
- number: 3,
- title: "Issue Already Fixed",
- labels: [{ name: ".Already Fixed" }, { name: "Embedding/Static" }],
- },
- {
- number: 4,
- title: "Issue That Users Don't Care About",
- labels: [
- { name: ".CI & Tests" },
- { name: "Administration/Permissions" },
- { name: "Embedding/Interactive" },
- ],
- },
- {
- number: 5,
- title: "Another feature issue",
- labels: [{ name: "Reporting/Dashboards" }],
- },
- {
- number: 6,
- title: "A bug fix that lacks a category label",
- labels: [{ name: "Type:Bug" }],
- },
- {
- number: 7,
- title: "SDK Package Bug Issue",
- labels: [
- { name: "Type:Bug" },
- { name: ".team/Embedding" },
- { name: "no-release-notes" },
- ],
- },
- {
- number: 8,
- title: "SDK Bundle Bug Issue",
- labels: [
- { name: "Type:Bug" },
- { name: ".team/Embedding" },
- { name: "Embedding/SDK" },
- ],
- },
- {
- number: 9,
- title: "SDK Bundle Another Bug Issue",
- labels: [{ name: "Type:Bug" }, { name: "Embedding/SDK" }],
- },
- ] as Issue[];
-
- it("should generate release notes", () => {
- const notes = generateReleaseNotes({
- version: "v1.2.3",
- template: websiteChangelogTemplate,
- issues,
- });
-
- expect(notes).toContain(
- "### Enhancements | 2.3\n\n**Querying**\n\n- Feature Issue (#2)",
- );
- expect(notes).toContain(
- "### Bug fixes | 2.3\n\n**Embedding**\n\n- Bug Issue (#1)\n- SDK Bundle Bug Issue (#8)\n- SDK Bundle Another Bug Issue (#9)",
- );
- expect(notes).toContain(
- "### Already Fixed | 2.3\n\nIssues confirmed to have been fixed in a previous release.\n\n**Embedding**\n\n- Issue Already Fixed (#3)",
- );
- expect(notes).toContain(
- "### Under the Hood | 2.3\n\n**Administration**\n\n- Issue That Users Don't Care About (#4)",
- );
-
- expect(notes).toContain("metabase/metabase-enterprise:v1.2.3.x");
- expect(notes).toContain("metabase/metabase:v0.2.3.x");
- expect(notes).toContain(
- "https://downloads.metabase.com/enterprise/v1.2.3.x/metabase.jar",
- );
- expect(notes).toContain(
- "https://downloads.metabase.com/v0.2.3.x/metabase.jar",
- );
- expect(notes).not.toContain("SDK Package Bug Issue");
- });
-
- it("should generate release notes from alternative templates", () => {
+ it("should generate github release notes", () => {
const notes = generateReleaseNotes({
version: "v1.2.3",
template: githubReleaseTemplate,
- issues,
});
expect(notes).toContain("https://www.metabase.com/changelog/");
@@ -139,387 +36,4 @@ describe("Release Notes", () => {
);
});
});
-
- describe("categorizeIssues", () => {
- it("should categorize bug issues", () => {
- const issue = {
- number: 1,
- title: "Bug Issue",
- labels: [{ name: "Type:Bug" }, { name: "Querying/MBQL" }],
- } as Issue;
-
- const categorizedIssues = categorizeIssues([issue]);
- const issuesAndCategories = {
- Querying: [
- {
- labels: [{ name: "Type:Bug" }, { name: "Querying/MBQL" }],
- number: 1,
- title: "Bug Issue",
- },
- ],
- };
-
- expect(categorizedIssues.bugFixes).toEqual(issuesAndCategories);
- });
-
- it("should categorize already fixed issues", () => {
- const issue = {
- number: 3,
- title: "Already Fixed Issue",
- labels: [{ name: ".Already Fixed" }],
- } as Issue;
-
- const categorizedIssues = categorizeIssues([issue]);
- const sortedIssues = {
- bugFixes: {},
- enhancements: {},
- alreadyFixedIssues: {
- Other: [
- {
- number: 3,
- title: "Already Fixed Issue",
- labels: [
- {
- name: ".Already Fixed",
- },
- ],
- },
- ],
- },
- underTheHoodIssues: {},
- };
-
- expect(categorizedIssues.alreadyFixedIssues).toEqual(
- sortedIssues.alreadyFixedIssues,
- );
- });
-
- it("should categorize non-user-facing issues", () => {
- const issue = {
- number: 4,
- title: "Non User Facing Issue",
- labels: [{ name: ".CI & Tests" }],
- } as Issue;
-
- const categorizedIssues = categorizeIssues([issue]);
- const sortedIssues = {
- bugFixes: {},
- enhancements: {},
- alreadyFixedIssues: {},
- underTheHoodIssues: {
- Other: [
- {
- number: 4,
- title: "Non User Facing Issue",
- labels: [{ name: ".CI & Tests" }],
- },
- ],
- },
- };
-
- expect(categorizedIssues.underTheHoodIssues).toEqual(
- sortedIssues.underTheHoodIssues,
- );
- });
-
- it("should categorize all other issues as enhancements", () => {
- const issue = {
- number: 2,
- title: "Big Feature",
- labels: [{ name: "something" }],
- } as Issue;
-
- const categorizedIssues = categorizeIssues([issue]);
- const sortedIssues = {
- bugFixes: {},
- enhancements: {
- Other: [
- {
- number: 2,
- title: "Big Feature",
- labels: [{ name: "something" }],
- },
- ],
- },
- alreadyFixedIssues: {},
- underTheHoodIssues: {},
- };
- expect(categorizedIssues.enhancements).toEqual(sortedIssues.enhancements);
- });
-
- it("should prioritize non-user-facing issues above all", () => {
- const issue = {
- number: 4,
- title: "Non User Facing Issue",
- labels: [
- { name: ".CI & Tests" },
- { name: "Type:Bug" },
- { name: ".Already Fixed" },
- { name: "Ptitard" },
- ],
- } as Issue;
-
- const categorizedIssues = categorizeIssues([issue]);
-
- const sortedIssues = {
- bugFixes: {},
- enhancements: {},
- alreadyFixedIssues: {},
- underTheHoodIssues: {
- Other: [
- {
- number: 4,
- title: "Non User Facing Issue",
- labels: [
- {
- name: ".CI & Tests",
- },
- {
- name: "Type:Bug",
- },
- {
- name: ".Already Fixed",
- },
- {
- name: "Ptitard",
- },
- ],
- },
- ],
- },
- };
-
- expect(categorizedIssues.underTheHoodIssues).toEqual(
- sortedIssues.underTheHoodIssues,
- );
- expect(categorizedIssues.bugFixes).toEqual({});
- expect(categorizedIssues.alreadyFixedIssues).toEqual({});
- expect(categorizedIssues.enhancements).toEqual({});
- });
-
- it("should omit hidden issues", () => {
- const issue = {
- number: 5,
- title: "Docs Issue",
- labels: [{ name: "Type:Documentation" }],
- } as Issue;
-
- const categorizedIssues = categorizeIssues([issue]);
-
- expect(categorizedIssues.enhancements).toEqual({});
- expect(categorizedIssues.bugFixes).toEqual({});
- expect(categorizedIssues.alreadyFixedIssues).toEqual({});
- expect(categorizedIssues.underTheHoodIssues).toEqual({});
- });
-
- it("should put issues in only one bucket", () => {
- const issues = [
- {
- number: 1,
- title: "Bug Issue",
- labels: [{ name: "Type:Bug" }, { name: "Embedding/Interactive" }],
- },
- {
- number: 2,
- title: "Big Feature",
- labels: [{ name: "something" }, { name: "Querying/MBQL" }],
- },
- {
- number: 3,
- title: "Already Fixed Issue",
- labels: [
- { name: ".Already Fixed" },
- { name: "Reporting/Dashboards" },
- ],
- },
- {
- number: 4,
- title: "Non User Facing Issue",
- labels: [{ name: ".CI & Tests" }],
- },
- {
- number: 5,
- title: "Non User Facing Issue 2",
- labels: [
- { name: ".Building & Releasing" },
- { name: "Visualization/Tables" },
- ],
- },
- {
- number: 6,
- title: "Docs Issue",
- labels: [
- { name: "Type:Documentation" },
- { name: "Reporting/Dashboards" },
- { name: "Databases/PostgreSQL" },
- ],
- },
- ] as Issue[];
-
- const categorizedIssues = categorizeIssues(issues);
-
- const sortedIssues = {
- bugFixes: {
- Embedding: [
- {
- number: 1,
- title: "Bug Issue",
- labels: [{ name: "Type:Bug" }, { name: "Embedding/Interactive" }],
- },
- ],
- },
- enhancements: {
- Querying: [
- {
- number: 2,
- title: "Big Feature",
- labels: [{ name: "something" }, { name: "Querying/MBQL" }],
- },
- ],
- },
- alreadyFixedIssues: {
- Reporting: [
- {
- number: 3,
- title: "Already Fixed Issue",
- labels: [
- { name: ".Already Fixed" },
- { name: "Reporting/Dashboards" },
- ],
- },
- ],
- },
- underTheHoodIssues: {
- Other: [
- {
- number: 4,
- title: "Non User Facing Issue",
- labels: [{ name: ".CI & Tests" }],
- },
- ],
- Visualization: [
- {
- number: 5,
- title: "Non User Facing Issue 2",
- labels: [
- { name: ".Building & Releasing" },
- { name: "Visualization/Tables" },
- ],
- },
- ],
- },
- };
-
- expect(categorizedIssues.bugFixes).toEqual(sortedIssues.bugFixes);
- expect(categorizedIssues.enhancements).toEqual(sortedIssues.enhancements);
- expect(categorizedIssues.alreadyFixedIssues).toEqual(
- sortedIssues.alreadyFixedIssues,
- );
- expect(categorizedIssues.underTheHoodIssues).toEqual(
- sortedIssues.underTheHoodIssues,
- );
- });
- });
-
- describe("markdownIssuelinks", () => {
- it("should generate markdown links for a single issue", () => {
- expect(markdownIssueLinks("(#12345) is done")).toEqual(
- "([#12345](https://github.com/metabase/metabase/issues/12345)) is done",
- );
- });
-
- it("should generate markdown links for a multiple issues", () => {
- expect(
- markdownIssueLinks(`
- (#12345) is done
- (#12346) is not done
- 12348 is not an issue
- `),
- ).toEqual(`
- ([#12345](https://github.com/metabase/metabase/issues/12345)) is done
- ([#12346](https://github.com/metabase/metabase/issues/12346)) is not done
- 12348 is not an issue
- `);
- });
-
- it("should preserve text without issue numbers", () => {
- expect(markdownIssueLinks("my text")).toEqual("my text");
- });
- });
-
- describe("getWebsiteChangelog", () => {
- const issues = [
- {
- number: 1,
- title: "Bug Issue",
- labels: [{ name: "Type:Bug" }, { name: "Embedding/Interactive" }],
- },
- {
- number: 2,
- title: "Feature Issue",
- labels: [{ name: "Querying/MBQL" }],
- },
- {
- number: 3,
- title: "Issue Already Fixed",
- labels: [{ name: ".Already Fixed" }, { name: "Embedding/Static" }],
- },
- {
- number: 4,
- title: "Issue That Users Don't Care About",
- labels: [
- { name: ".CI & Tests" },
- { name: "Administration/Permissions" },
- { name: "Embedding/Interactive" },
- ],
- },
- {
- number: 5,
- title: "Another feature issue",
- labels: [{ name: "Reporting/Dashboards" }],
- },
- {
- number: 6,
- title: "A bug fix that lacks a category label",
- labels: [{ name: "Type:Bug" }],
- },
- ] as Issue[];
-
- it("should generate a website changelog", () => {
- const notes = getWebsiteChangelog({
- version: "v1.2.3",
- issues,
- });
-
- expect(notes).toContain("### Enhancements");
- expect(notes).toContain("Metabase 2.3");
- expect(notes).toContain("- Issue That Users Don't Care About");
- });
-
- it("should linkify issue numbers", () => {
- const notes = getWebsiteChangelog({
- version: "v1.2.3",
- issues,
- });
-
- expect(notes).toContain("### Enhancements");
- expect(notes).toContain(
- "- Issue That Users Don't Care About ([#4](https://github.com/metabase/metabase/issues/4))",
- );
- });
- });
-
- it.each([
- ["v0.53.2", "53#metabase-532"],
- ["v1.53.0", "53#metabase-530"],
- ["v1.57.16", "57#metabase-5716"],
- ["v1.59.0.4-beta", "59#metabase-590"],
- ["v1.60.0", "60#metabase-600"],
- ["v0.32.0", "32#metabase-320"],
- ["v0.444.1", "444#metabase-4441"],
- ])("getChangelogUrl: %s -> %s", (input, expected) => {
- expect(getChangelogUrl(input)).toEqual(
- `https://www.metabase.com/changelog/${expected}`,
- );
- });
});
diff --git a/release/src/slack.ts b/release/src/slack.ts
index b21e88bb21a..b9aa2e095b5 100644
--- a/release/src/slack.ts
+++ b/release/src/slack.ts
@@ -1,11 +1,8 @@
import "dotenv/config";
-import fs from "fs";
-
import { WebClient } from "@slack/web-api";
import type { Block, KnownBlock, MessageAttachment } from "@slack/web-api";
import dayjs from "dayjs";
import relativeTime from "dayjs/plugin/relativeTime";
-import fetch from "node-fetch";
dayjs.extend(relativeTime);
@@ -689,104 +686,6 @@ export async function sendFlakeStatusReport({
});
}
-/**
- * uploading a file to slack is a three step process:
- * 1) make an api call to get a specific url to upload to
- * 2) make an http POST request to that url with the file
- * 3) make an api call to "complete" the upload and post it somewhere in slack
- */
-export async function uploadFileToSlack({
- channelName,
- thread_ts,
- fileName,
- file,
- message,
-}: {
- channelName: string;
- thread_ts?: string;
- fileName: string;
- file: Buffer;
- message: string;
-}) {
- console.log(`Uploading file ${fileName} to slack`);
-
- const uploadRequest = await slack.files.getUploadURLExternal({
- filename: fileName,
- length: file.length,
- });
-
- if (
- !uploadRequest.ok ||
- !uploadRequest.upload_url ||
- !uploadRequest.file_id
- ) {
- throw new Error(`Failed to get upload URL: ${uploadRequest.error}`);
- }
-
- const uploadResult = await fetch(uploadRequest.upload_url, {
- method: "POST",
- headers: {
- "Content-Type": "application/octet-stream",
- },
- body: file,
- });
-
- if (!uploadResult.ok) {
- throw new Error(`Failed to upload file: ${uploadResult.statusText}`);
- }
-
- const channelId = await getSlackChannelId(channelName);
-
- if (!channelId) {
- throw new Error("channel id not found");
- }
-
- return slack.files.completeUploadExternal({
- files: [{ id: uploadRequest.file_id, title: fileName }],
- channel_id: channelId,
- thread_ts,
- initial_comment: message,
- });
-}
-
-const milestoneCheckProjectUrl = "https://github.com/orgs/metabase/projects/93";
-
-export async function sendMilestoneCheckMessage({
- channelName,
- issueCount,
- version,
-}: {
- channelName: string;
- issueCount: number;
- version: string;
-}) {
- console.log("Sending milestone check slack message to ", channelName);
- let buildThread = await getExistingSlackMessage(version, channelName);
-
- // if we can't find a build thread, we'll make our own pre-build thread
- if (!buildThread) {
- const message = `:file_folder: *${getGenericVersion(version)} Pre-release milestone check*`;
- const response = await sendSlackMessage({ channelName, message });
- buildThread = { id: response.ts ?? "", body: message };
- }
-
- const message = `:mag: ${getGenericVersion(version)} has ${slackLink(`${issueCount} issues that need to be checked`, milestoneCheckProjectUrl)}`;
-
- await sendSlackReply({ message, channelName, messageId: buildThread.id });
-
- const fileName = `milestone-audit-${version}.md`;
- const file = fs.readFileSync("./" + fileName);
- const fileMessage = `:page_with_curl: ${getGenericVersion(version)} milestone audit`;
-
- return uploadFileToSlack({
- channelName,
- thread_ts: buildThread.id,
- fileName,
- file,
- message: fileMessage,
- });
-}
-
function chunk<T>(array: T[], count: number): T[][] {
const result: T[][] = [];
let i = 0;
diff --git a/release/src/tablePageTemplate.html b/release/src/tablePageTemplate.html
index d3a661e4404..89787225b28 100644
--- a/release/src/tablePageTemplate.html
+++ b/release/src/tablePageTemplate.html
@@ -1,8 +1,8 @@
<html>
<head>
<title>Metabase v{{major-version}} Release Log</title>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
font-family: Lato, sans-serif;
@@ -13,41 +13,36 @@
table {
border-collapse: collapse;
}
- th, td {
+ th,
+ td {
padding: 8px;
text-align: left;
}
tr:nth-child(even) {
background-color: #2e323a;
}
- tbody > tr:hover{
+ tbody > tr:hover {
color: #8fbdf6;
}
a {
text-decoration: underline;
- color:#2987f9;
+ color: #2987f9;
}
</style>
</head>
<body class="p-5 text-gray-200 bg-gray-800">
- <h1>Metabase v{{major-version}} Release Log</h1>
- <p>as of {{current-time}}</p>
- <h2>
- Pending Backports
- </h2>
- <div>
- {{backport-table}}
- </div>
- <h2>
- Merged Changes
- </h2>
- <div>
- <a href="https://github.com/metabase/metabase/commits/release-x.{{major-version}}.x/">
- View on GitHub
- </a>
- </div>
- <div>
- {{release-table}}
- </div>
+ <h1>Metabase v{{major-version}} Release Log</h1>
+ <p>as of {{current-time}}</p>
+ <h2>Pending Backports</h2>
+ <div>{{backport-table}}</div>
+ <h2>Merged Changes</h2>
+ <div>
+ <a
+ href="https://github.com/metabase/metabase/commits/release-x.{{major-version}}.x/"
+ >
+ View on GitHub
+ </a>
+ </div>
+ <div>{{release-table}}</div>
</body>
</html>
diff --git a/release/src/types.ts b/release/src/types.ts
index 41f49a1d0c6..1c00608916a 100644
--- a/release/src/types.ts
+++ b/release/src/types.ts
@@ -81,13 +81,6 @@ export type Milestone = {
description: string | null;
};
-export type Commit = {
- sha: string;
- commit: {
- message: string;
- };
-};
-
export type Tag = {
ref: string;
node_id: string;