This is an automated email from the ASF dual-hosted git repository.

vinishjail97 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-xtable.git


The following commit(s) were added to refs/heads/main by this push:
     new cdd2688c [858] Add commit co-author and PR title validation CI checks 
(#859)
cdd2688c is described below

commit cdd2688c23ba22cd9661a7f4115ca39b8c841d17
Author: Ranga Reddy <[email protected]>
AuthorDate: Fri Aug 7 04:02:11 2026 +0530

    [858] Add commit co-author and PR title validation CI checks (#859)
    
    * [858] Add commit co-author validation as a required CI check
    
    Add a GitHub Actions workflow that fails a PR when any of its commits
    carries a Claude co-author trailer (a Co-authored-by: line using
    [email protected] or naming a Claude model), so this is caught in CI
    rather than by reviewers. A human co-author with a personal email is not
    flagged.
    
    Register validate-commit-coauthor as a required status check on main in
    .asf.yaml. Adapted from apache/hudi#19134.
    
    * [858] Add PR title validation as a required CI check
    
    Add a GitHub Actions workflow that validates the PR title follows an
    accepted format: a GitHub issue reference "[<issue-number>] description",
    "[MINOR] description", or a Conventional Commit ("type(scope): subject").
    Register validate-pr-title as a required status check on main. Adapted
    from apache/hudi's pr_title_validation.yml.
---
 .asf.yaml                                        |  4 ++
 .github/workflows/commit_coauthor_validation.yml | 53 +++++++++++++++
 .github/workflows/pr_title_validation.yml        | 86 ++++++++++++++++++++++++
 3 files changed, 143 insertions(+)

diff --git a/.asf.yaml b/.asf.yaml
index b0ea482e..155f0b07 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -35,6 +35,10 @@ github:
     main:
       required_pull_request_reviews:
         required_approving_review_count: 1
+      required_status_checks:
+        contexts:
+          - validate-commit-coauthor
+          - validate-pr-title
 notifications:
     commits:      [email protected]
     issues:       [email protected]
diff --git a/.github/workflows/commit_coauthor_validation.yml 
b/.github/workflows/commit_coauthor_validation.yml
new file mode 100644
index 00000000..55cbbb11
--- /dev/null
+++ b/.github/workflows/commit_coauthor_validation.yml
@@ -0,0 +1,53 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+name: Commit Co-author Validation
+
+on:
+  pull_request:
+    types: [opened, reopened, synchronize]
+    branches:
+      - main
+
+concurrency:
+  group: commit-coauthor-validation-${{ github.ref }}
+  cancel-in-progress: ${{ !contains(github.ref, 'main') }}
+
+jobs:
+  validate-commit-coauthor:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check commits for Claude co-author trailers
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          REPO: ${{ github.repository }}
+          PR_NUMBER: ${{ github.event.pull_request.number }}
+        run: |
+          echo "Checking commits of PR #${PR_NUMBER} for Claude co-author 
trailers..."
+          flagged=$(gh api "repos/${REPO}/pulls/${PR_NUMBER}/commits" 
--paginate \
+            --jq '.[] | select(.commit.message | 
test("(^|\\n)co-authored-by:\\s*(claude\\s+(opus|sonnet|haiku|fable|mythos|instant|code|[0-9])|[^\\n]*<noreply@anthropic\\.com>)";
 "i")) | .sha')
+
+          if [[ -n "$flagged" ]]; then
+            echo "❌ The following commits contain a Claude co-author trailer:"
+            echo "$flagged"
+            echo ""
+            echo "Commits must not credit Claude as a co-author."
+            echo "Remove the 'Co-authored-by: Claude ...' trailer from the 
commit message(s),"
+            echo "e.g., by amending the commit or rebasing, and force-push the 
branch."
+            exit 1
+          fi
+
+          echo "✅ No Claude co-author trailers found."
diff --git a/.github/workflows/pr_title_validation.yml 
b/.github/workflows/pr_title_validation.yml
new file mode 100644
index 00000000..16281dd7
--- /dev/null
+++ b/.github/workflows/pr_title_validation.yml
@@ -0,0 +1,86 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+name: PR Title Validation
+
+on:
+  pull_request:
+    types: [opened, edited, reopened, synchronize]
+    branches:
+      - main
+
+concurrency:
+  group: pr-title-validation-${{ github.ref }}
+  cancel-in-progress: ${{ !contains(github.ref, 'main') }}
+
+jobs:
+  validate-pr-title:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Check for bracketed PR title format
+        id: check-bracket-format
+        env:
+          PR_TITLE: ${{ github.event.pull_request.title }}
+        run: |
+          title="$PR_TITLE"
+          echo "Checking PR title: $title"
+
+          # GitHub issue reference format: [1234] description
+          if [[ "$title" =~ ^\[[0-9]+\]\ .+ ]]; then
+            echo "✅ Title matches [<issue-number>] format"
+            echo "skip_conventional=true" >> $GITHUB_OUTPUT
+            exit 0
+          fi
+
+          # MINOR format: [MINOR] description
+          if [[ "$title" =~ ^\[MINOR\]\ .+ ]]; then
+            echo "✅ Title matches [MINOR] format"
+            echo "skip_conventional=true" >> $GITHUB_OUTPUT
+            exit 0
+          fi
+
+          echo "Title does not match [<issue-number>]/[MINOR] format, will 
validate as a conventional commit"
+          echo "skip_conventional=false" >> $GITHUB_OUTPUT
+
+      - name: Validate PR title with Conventional Commits spec
+        if: steps.check-bracket-format.outputs.skip_conventional == 'false'
+        uses: 
amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # 
v6
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          types: |
+            feat
+            fix
+            docs
+            style
+            refactor
+            perf
+            test
+            build
+            ci
+            chore
+          requireScope: false
+          # Be permissive about the subject text itself; only require it be 
non-empty.
+          subjectPattern: ^.+$
+          subjectPatternError: |
+            The subject "{subject}" found in the pull request title "{title}"
+            is empty. Please provide a meaningful description.
+          ignoreLabels: |
+            bot
+            ignore-semantic-pull-request
+          validateSingleCommit: false
+          headerPattern: '^(\w+)(?:\(([^)]+)\))?!?: (.+)$'
+          headerPatternCorrespondence: type,scope,subject

Reply via email to