edk12564 commented on code in PR #5437:
URL: https://github.com/apache/fineract/pull/5437#discussion_r2824587173
##########
.github/workflows/pr-one-commit-per-user-check.yml:
##########
@@ -0,0 +1,57 @@
+name: Fineract PR One Commit Per User Check
+
+
+on:
+ pull_request:
+ types: [opened, reopened, synchronize]
+
+
+permissions:
+ pull-requests: write
+
+
+jobs:
+ verify-commits:
+ name: Validate One Commit Per User
+ runs-on: ubuntu-latest
+ timeout-minutes: 1
+ steps:
+ - name: Verify Commit Policy
+ id: check
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ run: |
+
+ commits=$(gh api "repos/$REPO/pulls/$PR_NUMBER/commits") || { echo
"::error::GitHub API request failed"; exit 1; }
+
+ if echo "$commits" | jq -e '.[] | select(.author == null)' >
/dev/null; then
+ echo "null_authors=true" >> $GITHUB_OUTPUT
+ echo "::error::Some commits have a git email that is not linked to
a GitHub account. Please ensure your git email matches one of your GitHub
Account emails."
+ exit 1
+ fi
+
+ user_ids=$(echo "$commits" | jq -r '.[] | select(.author.type !=
"Bot") | .author.id')
+ if echo "$user_ids" | sort | uniq -d | grep -q .; then
+ echo "multiple_commits=true" >> $GITHUB_OUTPUT
+ echo "::error::Multiple commits from the same author have been
detected."
+ exit 1
+ fi
+
+ echo "Success: Each author has exactly one commit."
+
+ - name: Comment on PR
+ if: failure()
+ env:
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Review Comment:
Hi adam! Really sorry about this but I made a post in the dev mail list
before I read this comment. That's completely my bad.
To summarize the post, I wrote on a potential improvement to One Commit per
PR that might allow us to keep full credit for everyone involved. We can add
co-contributors to Co-Authored-By and also the trailer they performed work in,
like Designed-By or Tested-By. This gives them full contribution in Github's
eyes without having multiple users in a commit. But the tradeoff is still that
each person cannot sign their commit, like they can in One Commit per User as
Aman mentioned.
Would you still like One Commit Per User here given the new information? I
will say that the implementation works either way!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]