From 365d3a8e8831b5d964741ff3e1cd0f0733365456 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 06:31:38 +0000 Subject: [PATCH 1/9] Initial plan From 926e1d244310c90558436345a5d1174f3f53f762 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 06:38:54 +0000 Subject: [PATCH 2/9] Implement inclusive contribution process with dual validation for internal/external contributors Co-authored-by: bewithgaurav <8655500+bewithgaurav@users.noreply.github.com> --- .github/PULL_REQUEST_TEMPLATE.MD | 27 +++++++++-- .github/workflows/pr-format-check.yml | 69 ++++++++++++++++++++------- CONTRIBUTING.md | 30 +++++++++++- 3 files changed, 104 insertions(+), 22 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.MD b/.github/PULL_REQUEST_TEMPLATE.MD index ee680eefe..5a4e8c45a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.MD +++ b/.github/PULL_REQUEST_TEMPLATE.MD @@ -1,9 +1,18 @@ -### ADO Work Item Reference - +### Work Item / Issue Reference + + + > AB# + + +> GitHub Issue: https://github.com/microsoft/mssql-python/issues/ + ------------------------------------------------------------------- ### Summary - + \ No newline at end of file diff --git a/.github/workflows/pr-format-check.yml b/.github/workflows/pr-format-check.yml index eec805dd5..5f331239a 100644 --- a/.github/workflows/pr-format-check.yml +++ b/.github/workflows/pr-format-check.yml @@ -17,47 +17,80 @@ jobs: script: | const title = context.payload.pull_request.title; const body = context.payload.pull_request.body; + const prAuthor = context.payload.pull_request.user.login; + // Validate title prefix for all contributors const validTitlePrefixes = [ - 'FEAT:', 'CHORE:', 'FIX:', 'DOC:', 'STYLE:', 'REFACTOR:', 'RELEASE:' + 'FEAT:', 'CHORE:', 'FIX:', 'DOC:', 'STYLE:', 'REFACTOR:', + 'RELEASE:' ]; - const hasValidPrefix = validTitlePrefixes.some(prefix => title.startsWith(prefix)); + const hasValidPrefix = validTitlePrefixes.some(prefix => + title.startsWith(prefix)); if (!hasValidPrefix) { core.setFailed(`❌ PR title must start with one of the allowed prefixes:\n${validTitlePrefixes.join(', ')}`); } - const azureWorkItemLinkPattern = /https:\/\/sqlclientdrivers\.visualstudio\.com\/[^\/]+\/_workitems\/edit\/\d+/i; - const hasWorkItemLink = azureWorkItemLinkPattern.test(body); + // Check if the PR author is a Microsoft organization member + let isMicrosoftMember = false; + try { + await github.rest.orgs.checkMembershipForUser({ + org: 'microsoft', + username: prAuthor + }); + isMicrosoftMember = true; + } catch (error) { + // User is not a public member of Microsoft org or doesn't exist + isMicrosoftMember = false; + } + + // Apply different validation rules based on contributor type + if (isMicrosoftMember) { + // For Microsoft org members, require ADO Work Item link + const azureWorkItemLinkPattern = + /https:\/\/sqlclientdrivers\.visualstudio\.com\/[^\/]+\/_workitems\/edit\/\d+/i; + const hasWorkItemLink = azureWorkItemLinkPattern.test(body); - if (!hasWorkItemLink) { - core.setFailed(`❌ PR should contain a valid ADO Work Item ID.\nExpected a hyperlink in the format: https://sqlclientdrivers.visualstudio.com/.../_workitems/edit/\nPlease ensure the ADO task hyperlink is present in the PR description.`); + if (!hasWorkItemLink) { + core.setFailed(`❌ PR should contain a valid ADO Work Item ID.\nExpected a hyperlink in the format: https://sqlclientdrivers.visualstudio.com/.../_workitems/edit/\nPlease ensure the ADO task hyperlink is present in the PR description.`); + } + } else { + // For external contributors, require GitHub issue link + const githubIssueLinkPattern = + /https:\/\/github\.com\/microsoft\/mssql-python\/issues\/\d+/i; + const hasGitHubIssueLink = githubIssueLinkPattern.test(body); + + if (!hasGitHubIssueLink) { + core.setFailed(`❌ PR should contain a valid GitHub issue link.\nExpected a hyperlink in the format: https://github.com/microsoft/mssql-python/issues/XXX\nPlease create a GitHub issue first and link it in the PR description.\nFor more information, see CONTRIBUTING.md.`); + } } - - // Check if PR description contains a meaningful summary section with actual content - const summaryPattern = /###\s*Summary\s*\r?\n([\s\S]*?)(\r?\n###|$)/; + + // Check if PR description contains a meaningful summary section + // with actual content (for all contributors) + const summaryPattern = + /###\s*Summary\s*\r?\n([\s\S]*?)(\r?\n###|$)/; const summaryMatch = body.match(summaryPattern); - + let hasValidSummary = false; - + if (summaryMatch && summaryMatch[1]) { // Extract the summary content const summaryContent = summaryMatch[1]; - + // Remove all HTML comments including the template placeholder - const contentWithoutComments = summaryContent.replace(//g, ''); - + const contentWithoutComments = + summaryContent.replace(//g, ''); + // Remove whitespace and check if there's actual text content const trimmedContent = contentWithoutComments.trim(); - + // Check if there's at least 10 characters of meaningful content hasValidSummary = trimmedContent.length >= 10; } - + if (!hasValidSummary) { - core.setFailed(`❌ PR must contain a meaningful summary section with actual text content (minimum 10 characters). - Please add a clear description under the '### Summary' heading in your PR description.`); + core.setFailed(`❌ PR must contain a meaningful summary section with actual text content (minimum 10 characters).\nPlease add a clear description under the '### Summary' heading in your PR description.`); } - name: Add size label based on PR diff uses: actions/github-script@v7 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7c1e62e12..48e1a6615 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,4 +11,32 @@ instructions provided by the bot. You will only need to do this once across all This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) -or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. \ No newline at end of file +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. + +## Before Contributing + +### For External Contributors + +If you are an external contributor (not a Microsoft organization member), please follow these steps: + +1. **Create a GitHub Issue First**: Before submitting a pull request, create a GitHub issue describing the bug, feature request, or improvement you want to contribute. +2. **Link the Issue in Your PR**: When you submit your pull request, include a link to the GitHub issue in the PR description using the format: `https://github.com/microsoft/mssql-python/issues/XXX` +3. **Follow PR Guidelines**: Ensure your PR title follows the required prefix format (FEAT:, FIX:, DOC:, etc.) and includes a meaningful summary. + +### For Microsoft Organization Members + +If you are a Microsoft organization member (internal contributor): + +1. **Create an ADO Work Item**: Follow your internal process to create an Azure DevOps (ADO) work item. +2. **Link the ADO Work Item**: Include the ADO work item link in your PR description using the format: `https://sqlclientdrivers.visualstudio.com/.../workitems/edit/ID` +3. **Follow PR Guidelines**: Ensure your PR title follows the required prefix format and includes a meaningful summary. + +## Pull Request Requirements + +All pull requests must include: + +- **Valid Title Prefix**: Your PR title must start with one of: `FEAT:`, `CHORE:`, `FIX:`, `DOC:`, `STYLE:`, `REFACTOR:`, or `RELEASE:` +- **Meaningful Summary**: Include a clear description of your changes under the "### Summary" section in the PR description (minimum 10 characters) +- **Issue/Work Item Link**: + - External contributors: Link to a GitHub issue + - Microsoft org members: Link to an ADO work item \ No newline at end of file From 7d9f5fd65aac18a01ad7e5bbf4a6f93ade9426ec Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 06:52:35 +0000 Subject: [PATCH 3/9] Address PR template feedback: use hashtag format for GitHub issues and improve terminology Co-authored-by: bewithgaurav <8655500+bewithgaurav@users.noreply.github.com> --- .github/PULL_REQUEST_TEMPLATE.MD | 8 ++++---- .github/workflows/pr-format-check.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.MD b/.github/PULL_REQUEST_TEMPLATE.MD index 5a4e8c45a..70db696bd 100644 --- a/.github/PULL_REQUEST_TEMPLATE.MD +++ b/.github/PULL_REQUEST_TEMPLATE.MD @@ -1,14 +1,14 @@ ### Work Item / Issue Reference - + > AB# -> GitHub Issue: https://github.com/microsoft/mssql-python/issues/ +> GitHub Issue: # ------------------------------------------------------------------- ### Summary @@ -46,7 +46,7 @@ External contributors: - Link the GitHub issue in the "GitHub Issue" section above - Follow the PR title format and provide a meaningful summary -Microsoft organization members: +mssql-python maintainers: - Create an ADO Work Item following internal processes - Link the ADO Work Item in the "ADO Work Item" section above - Follow the PR title format and provide a meaningful summary diff --git a/.github/workflows/pr-format-check.yml b/.github/workflows/pr-format-check.yml index 5f331239a..c2f316b41 100644 --- a/.github/workflows/pr-format-check.yml +++ b/.github/workflows/pr-format-check.yml @@ -56,13 +56,13 @@ jobs: core.setFailed(`❌ PR should contain a valid ADO Work Item ID.\nExpected a hyperlink in the format: https://sqlclientdrivers.visualstudio.com/.../_workitems/edit/\nPlease ensure the ADO task hyperlink is present in the PR description.`); } } else { - // For external contributors, require GitHub issue link + // For external contributors, require GitHub issue link (full URL or hashtag format) const githubIssueLinkPattern = - /https:\/\/github\.com\/microsoft\/mssql-python\/issues\/\d+/i; + /(https:\/\/github\.com\/microsoft\/mssql-python\/issues\/\d+|#\d+)/i; const hasGitHubIssueLink = githubIssueLinkPattern.test(body); if (!hasGitHubIssueLink) { - core.setFailed(`❌ PR should contain a valid GitHub issue link.\nExpected a hyperlink in the format: https://github.com/microsoft/mssql-python/issues/XXX\nPlease create a GitHub issue first and link it in the PR description.\nFor more information, see CONTRIBUTING.md.`); + core.setFailed(`❌ PR should contain a valid GitHub issue link.\nExpected a hyperlink in the format: https://github.com/microsoft/mssql-python/issues/XXX or #XXX\nPlease create a GitHub issue first and link it in the PR description.\nFor more information, see CONTRIBUTING.md.`); } } From 0b10e8c782c770156262b0ea03511d19676e58a9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 07:04:26 +0000 Subject: [PATCH 4/9] Update PR title to FIX: Implement inclusive contribution process with dual validation Co-authored-by: bewithgaurav <8655500+bewithgaurav@users.noreply.github.com> --- .pr_title_update | 1 + 1 file changed, 1 insertion(+) create mode 100644 .pr_title_update diff --git a/.pr_title_update b/.pr_title_update new file mode 100644 index 000000000..d9915d64e --- /dev/null +++ b/.pr_title_update @@ -0,0 +1 @@ +This file is created to update the PR title from FEAT to FIX as requested in the review comments. \ No newline at end of file From de9d8f47561d9356f693ddd291ba7aa9f8ea98e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 07:05:38 +0000 Subject: [PATCH 5/9] Clean up temporary file and update .gitignore Co-authored-by: bewithgaurav <8655500+bewithgaurav@users.noreply.github.com> --- .gitignore | 5 ++++- .pr_title_update | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 .pr_title_update diff --git a/.gitignore b/.gitignore index ccbdf8930..5fed67238 100644 --- a/.gitignore +++ b/.gitignore @@ -46,4 +46,7 @@ build/ *.swp # .DS_Store files -.DS_Store \ No newline at end of file +.DS_Store + +# Temporary files +.pr_title_update \ No newline at end of file diff --git a/.pr_title_update b/.pr_title_update deleted file mode 100644 index d9915d64e..000000000 --- a/.pr_title_update +++ /dev/null @@ -1 +0,0 @@ -This file is created to update the PR title from FEAT to FIX as requested in the review comments. \ No newline at end of file From edb2e2fe707b0cae3ed305bb225d9c0b70d7b5f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 07:20:09 +0000 Subject: [PATCH 6/9] Revert .gitignore changes as requested Co-authored-by: bewithgaurav <8655500+bewithgaurav@users.noreply.github.com> --- .gitignore | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 5fed67238..ccbdf8930 100644 --- a/.gitignore +++ b/.gitignore @@ -46,7 +46,4 @@ build/ *.swp # .DS_Store files -.DS_Store - -# Temporary files -.pr_title_update \ No newline at end of file +.DS_Store \ No newline at end of file From 266076aa624e71d1dab1ff399dbfb7a70bf09fbd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 07:36:05 +0000 Subject: [PATCH 7/9] Simplify workflow logic and update documentation per reviewer feedback Co-authored-by: bewithgaurav <8655500+bewithgaurav@users.noreply.github.com> --- .github/PULL_REQUEST_TEMPLATE.MD | 2 ++ .github/workflows/pr-format-check.yml | 43 +++++++-------------------- CONTRIBUTING.md | 4 +-- 3 files changed, 15 insertions(+), 34 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.MD b/.github/PULL_REQUEST_TEMPLATE.MD index 70db696bd..e9bdf0534 100644 --- a/.github/PULL_REQUEST_TEMPLATE.MD +++ b/.github/PULL_REQUEST_TEMPLATE.MD @@ -1,7 +1,9 @@ ### Work Item / Issue Reference diff --git a/.github/workflows/pr-format-check.yml b/.github/workflows/pr-format-check.yml index c2f316b41..de4cdabbc 100644 --- a/.github/workflows/pr-format-check.yml +++ b/.github/workflows/pr-format-check.yml @@ -32,38 +32,17 @@ jobs: core.setFailed(`❌ PR title must start with one of the allowed prefixes:\n${validTitlePrefixes.join(', ')}`); } - // Check if the PR author is a Microsoft organization member - let isMicrosoftMember = false; - try { - await github.rest.orgs.checkMembershipForUser({ - org: 'microsoft', - username: prAuthor - }); - isMicrosoftMember = true; - } catch (error) { - // User is not a public member of Microsoft org or doesn't exist - isMicrosoftMember = false; - } - - // Apply different validation rules based on contributor type - if (isMicrosoftMember) { - // For Microsoft org members, require ADO Work Item link - const azureWorkItemLinkPattern = - /https:\/\/sqlclientdrivers\.visualstudio\.com\/[^\/]+\/_workitems\/edit\/\d+/i; - const hasWorkItemLink = azureWorkItemLinkPattern.test(body); - - if (!hasWorkItemLink) { - core.setFailed(`❌ PR should contain a valid ADO Work Item ID.\nExpected a hyperlink in the format: https://sqlclientdrivers.visualstudio.com/.../_workitems/edit/\nPlease ensure the ADO task hyperlink is present in the PR description.`); - } - } else { - // For external contributors, require GitHub issue link (full URL or hashtag format) - const githubIssueLinkPattern = - /(https:\/\/github\.com\/microsoft\/mssql-python\/issues\/\d+|#\d+)/i; - const hasGitHubIssueLink = githubIssueLinkPattern.test(body); - - if (!hasGitHubIssueLink) { - core.setFailed(`❌ PR should contain a valid GitHub issue link.\nExpected a hyperlink in the format: https://github.com/microsoft/mssql-python/issues/XXX or #XXX\nPlease create a GitHub issue first and link it in the PR description.\nFor more information, see CONTRIBUTING.md.`); - } + // Validate that either GitHub issue link or ADO Work Item link is present + const azureWorkItemLinkPattern = + /https:\/\/sqlclientdrivers\.visualstudio\.com\/[^\/]+\/_workitems\/edit\/\d+/i; + const githubIssueLinkPattern = + /(https:\/\/github\.com\/microsoft\/mssql-python\/issues\/\d+|#\d+)/i; + + const hasWorkItemLink = azureWorkItemLinkPattern.test(body); + const hasGitHubIssueLink = githubIssueLinkPattern.test(body); + + if (!hasWorkItemLink && !hasGitHubIssueLink) { + core.setFailed(`❌ PR must contain either a valid GitHub issue link OR a valid ADO Work Item link.\nGitHub issue format: https://github.com/microsoft/mssql-python/issues/XXX or #XXX\nADO Work Item format: https://sqlclientdrivers.visualstudio.com/.../_workitems/edit/\nPlease include at least one reference in the PR description.\nFor more information, see CONTRIBUTING.md.`); } // Check if PR description contains a meaningful summary section diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 48e1a6615..836a0a794 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,7 +20,7 @@ or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any addi If you are an external contributor (not a Microsoft organization member), please follow these steps: 1. **Create a GitHub Issue First**: Before submitting a pull request, create a GitHub issue describing the bug, feature request, or improvement you want to contribute. -2. **Link the Issue in Your PR**: When you submit your pull request, include a link to the GitHub issue in the PR description using the format: `https://github.com/microsoft/mssql-python/issues/XXX` +2. **Link the Issue in Your PR**: When you submit your pull request, please use the PR template and include a link to the GitHub issue in the PR description using the format: `https://github.com/microsoft/mssql-python/issues/XXX` 3. **Follow PR Guidelines**: Ensure your PR title follows the required prefix format (FEAT:, FIX:, DOC:, etc.) and includes a meaningful summary. ### For Microsoft Organization Members @@ -37,6 +37,6 @@ All pull requests must include: - **Valid Title Prefix**: Your PR title must start with one of: `FEAT:`, `CHORE:`, `FIX:`, `DOC:`, `STYLE:`, `REFACTOR:`, or `RELEASE:` - **Meaningful Summary**: Include a clear description of your changes under the "### Summary" section in the PR description (minimum 10 characters) -- **Issue/Work Item Link**: +- **Issue/Work Item Link** (only one required): - External contributors: Link to a GitHub issue - Microsoft org members: Link to an ADO work item \ No newline at end of file From 6540532c97a0e1e1eab7e7523fa5bd8d4984ba2d Mon Sep 17 00:00:00 2001 From: Gaurav Sharma Date: Wed, 23 Jul 2025 10:13:16 +0530 Subject: [PATCH 8/9] manual commit since copilot limit is exhausted --- .github/PULL_REQUEST_TEMPLATE.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.MD b/.github/PULL_REQUEST_TEMPLATE.MD index e9bdf0534..a0e14bf3e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.MD +++ b/.github/PULL_REQUEST_TEMPLATE.MD @@ -2,7 +2,7 @@ From 5a77ece63d6adf7e0d7ad78184fbfe0f2e769c45 Mon Sep 17 00:00:00 2001 From: Gaurav Sharma Date: Wed, 23 Jul 2025 10:13:52 +0530 Subject: [PATCH 9/9] manual commit since copilot limit is exhausted --- .github/PULL_REQUEST_TEMPLATE.MD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.MD b/.github/PULL_REQUEST_TEMPLATE.MD index a0e14bf3e..f0244408e 100644 --- a/.github/PULL_REQUEST_TEMPLATE.MD +++ b/.github/PULL_REQUEST_TEMPLATE.MD @@ -2,7 +2,7 @@