Jobs_Applier_AI_Agent icon indicating copy to clipboard operation
Jobs_Applier_AI_Agent copied to clipboard

[FEATURE]: Git Co-Author - GitHub actions

Open surapuramakhil opened this issue 3 months ago • 1 comments

Feature summary

Problem to fix when commits are sqashed.

Feature description

this is a common problem - when commits are squashed during PR merges - credit for original contributors gets lot.

git co-author is for that

https://www.dormant.ninja/git-co-author-script/

draft co author - github CI

name: Add Co-Authors
on:
  pull_request:
    types: [closed]
jobs:
  add-coauthors:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Add co-authors
        run: |
          # Extract contributors and append as co-authors (refer script)
          
# Define the base branch (e.g., main or master)
BASE_BRANCH=main

# Find the merge base (divergence point) between the current branch and the base branch
MERGE_BASE=$(git merge-base HEAD $BASE_BRANCH)

# Extract contributors from the commits starting at the merge base up to HEAD
CONTRIBUTORS=$(git log $MERGE_BASE..HEAD --format='%aN <%aE>' | sort | uniq)

# Output or append contributors as Co-authored-by lines
for CONTRIBUTOR in $CONTRIBUTORS; do
  echo "Co-authored-by: $CONTRIBUTOR"
done

Motivation

No response

Alternatives considered

No response

Additional context

No response

surapuramakhil avatar Nov 20 '24 12:11 surapuramakhil