The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Drop conventional commit PR title reminder (#78888)
Nicolò Prettod140a6f45135
diff --git a/.github/file-paths.yaml b/.github/file-paths.yamlindex 75b0a63e03a..4a8f3f4b0ac 100644--- a/.github/file-paths.yaml+++ b/.github/file-paths.yaml@@ -54,11 +54,6 @@ frontend_sources: &frontend_sources- "enterprise/frontend/!(test)**/**/{!(*.spec),}.{js,jsx,ts,tsx,css}"- "frontend/!(test)**/**/{!(*.spec),}.{js,jsx,ts,tsx,css}"-# Used only in .github/workflows/conventional-commit-pr-title-reminder.yml-frontend_embedding_sources:- - "enterprise/frontend/src/{embedding,embedding-*}/**/{!(*.spec),}.{js,jsx,ts,tsx,css}"- - "enterprise/frontend/src/metabase-enterprise/{embedding,embedding-*}**/{!(*.spec),}.{js,jsx,ts,tsx,css}"-# Used only in .github/workflows/embedding-sdk-labels-reminder.ymlfrontend_embedding_sdk_package_sources:- "enterprise/frontend/src/embedding-sdk-package/**/!(*.spec).{js,jsx,ts,tsx,css}"diff --git a/.github/scripts/conventional-commit-pr-title-reminder/utils.js b/.github/scripts/conventional-commit-pr-title-reminder/utils.jsdeleted file mode 100644index b63b88710fd..00000000000--- a/.github/scripts/conventional-commit-pr-title-reminder/utils.js+++ /dev/null@@ -1,109 +0,0 @@-const TYPES = new Set([- "feat",- "fix",- "perf",- "docs",- "style",- "refactor",- "test",- "build",- "ci",-]);--/**- * @param title {string}- */-function isConventionalTitle(title) {- const match = /^(?<type>\w+)\((?<rawScopes>[^)]+)\):/.exec(title);-- if (!match) {- return false;- }-- const [, type, rawScopes] = match;- const scopes = rawScopes- .split(",")- .map((scope) => scope.trim())- .filter(Boolean);-- return TYPES.has(type) && scopes.length > 0;-}--/** @param {import('@types/github-script').AsyncFunctionArguments} AsyncFunctionArguments */-async function updateCommentForEmbedding({ github, context }) {- const githubUsername = context.payload.sender.login;-- const comment = `${CONVENTIONAL_COMMENT_IDENTIFIER}-@${githubUsername} You have modified embedding code. Please make sure the PR title follows [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) style.-Here are all the supported types:-- \`feat\`-- \`fix\`-- \`perf\`-- \`docs\`-- \`style\`-- \`refactor\`-- \`test\`-- \`build\`-- \`ci\`--Please also make sure to include a scope.--For example, these are valid PR titles:-- \`feat(sdk-bundle): Add interactive dashboard component\`-- \`fix(sdk-package): Fixed MetabaseProviderPropsStore logic\`-- \`fix(sdk-package, embed-js): Fix API\``;-- return updateComment(comment, { github, context });-}--/**- * @param comment {string}- * @param {import('@types/github-script').AsyncFunctionArguments} AsyncFunctionArguments- */-async function updateComment(comment, { github, context }) {- const owner = context.repo.owner;- const repo = context.repo.repo;- const pullRequestNumber = context.issue.number;- const comments = await github.rest.issues.listComments({- owner,- repo,- issue_number: pullRequestNumber,- });-- const existingComment = getExistingConventionalCommitReminderComment(- comments.data,- );-- if (existingComment) {- return await github.rest.issues.updateComment({- owner,- repo,- comment_id: existingComment.id,- body: comment,- });- } else {- return await github.rest.issues.createComment({- owner,- repo,- issue_number: pullRequestNumber,- body: comment,- });- }-}--const CONVENTIONAL_COMMENT_IDENTIFIER =- "<!---conventional comment identifier-->";--/**- * @param comments {{body: string}[]}- */-function getExistingConventionalCommitReminderComment(comments) {- for (const comment of comments) {- if (comment.body.startsWith(CONVENTIONAL_COMMENT_IDENTIFIER)) {- return comment;- }- }-}--exports.isConventionalTitle = isConventionalTitle;-exports.updateCommentForEmbedding = updateCommentForEmbedding;diff --git a/.github/scripts/conventional-commit-pr-title-reminder/utils.unit.spec.js b/.github/scripts/conventional-commit-pr-title-reminder/utils.unit.spec.jsdeleted file mode 100644index 752b3113dca..00000000000--- a/.github/scripts/conventional-commit-pr-title-reminder/utils.unit.spec.js+++ /dev/null@@ -1,45 +0,0 @@-const { isConventionalTitle } = require("./utils");--describe("isConventionalTitle", () => {- it("returns true for a simple conventional commit", () => {- expect(isConventionalTitle("feat: add new feature")).toBe(false);- });-- it("returns true for a commit with a scope", () => {- expect(isConventionalTitle("fix(api): correct API bug")).toBe(true);- });-- it("returns true for a commit with multiple scopes, comma separated", () => {- expect(isConventionalTitle("feat(build,deps): update dependencies")).toBe(- true,- );- });-- it("returns true for a commit with multiple scopes, comma separated with space", () => {- expect(isConventionalTitle("feat(build, deps): update dependencies")).toBe(- true,- );- });-- it("returns false for a commit with round brackets in a message", () => {- expect(isConventionalTitle("feat: (something) update dependencies")).toBe(- false,- );- });-- it("returns false for missing colon", () => {- expect(isConventionalTitle("feat add feature")).toBe(false);- });-- it("returns false for invalid type", () => {- expect(isConventionalTitle("invalidType: some message")).toBe(false);- });-- it("returns false for empty message", () => {- expect(isConventionalTitle("feat:")).toBe(false);- });-- it("returns false for empty input", () => {- expect(isConventionalTitle("")).toBe(false);- });-});diff --git a/.github/workflows/conventional-commit-pr-title-reminder.yml b/.github/workflows/conventional-commit-pr-title-reminder.ymldeleted file mode 100644index cb668cf227c..00000000000--- a/.github/workflows/conventional-commit-pr-title-reminder.yml+++ /dev/null@@ -1,56 +0,0 @@-name: Conventional commit PR Title Reminder--on:- pull_request:- branches:- - master--jobs:- files-changed:- name: Check which files changed- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 3- outputs:- frontend_embedding_sources: ${{ steps.changes.outputs.frontend_embedding_sources }}- steps:- - uses: actions/checkout@v6- - name: Test which files changed- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1- id: changes- with:- token: ${{ github.token }}- filters: .github/file-paths.yaml-- pr-title-reminder:- runs-on: ${{ vars.DEFAULT_RUNNER_KEY }}- timeout-minutes: 5- permissions:- pull-requests: write- needs: [ files-changed ]- if: |- !cancelled() &&- needs.files-changed.outputs.frontend_embedding_sources == 'true'- steps:- - uses: actions/checkout@v6- with:- ref: ${{ github.head_ref }}-- - name: Check if the PR title is already following Conventional Commits style- uses: actions/github-script@v9- id: is-conventional-commit- with:- result-encoding: string- script: | # js- const { isConventionalTitle } = require(".github/scripts/conventional-commit-pr-title-reminder/utils.js")- const pullRequestTitle = context.payload.pull_request.title-- return isConventionalTitle(pullRequestTitle)-- - name: Remind PR authors to use conventional commit in the title- if: ${{ steps.is-conventional-commit.outputs.result != 'true' }}- uses: actions/github-script@v9- with:- script: | #js- const { updateCommentForEmbedding } = require(".github/scripts/conventional-commit-pr-title-reminder/utils.js")-- await updateCommentForEmbedding({github, context})