Skip to content

Commit

Permalink
added co-authors
Browse files Browse the repository at this point in the history
  • Loading branch information
divyamb08 committed Dec 2, 2024
1 parent 892a6fb commit fc6df4b
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/add-coauthors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Add Co-Authors
on:
pull_request:
types: [closed]

jobs:
add-coauthors:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Add co-authors
run: |
# Get the merge commit SHA
MERGE_COMMIT_SHA=$(git rev-parse HEAD)
# Get the base branch (target of PR)
BASE_BRANCH="${{ github.event.pull_request.base.ref }}"
# Find merge base
MERGE_BASE=$(git merge-base HEAD $BASE_BRANCH)
# Extract unique contributors
CONTRIBUTORS=$(git log $MERGE_BASE..$MERGE_COMMIT_SHA --format='%aN <%aE>' | sort -u | grep -v 'GitHub Actions')
# Get the current commit message
COMMIT_MSG=$(git log -1 --pretty=%B)
# Create new commit message with co-authors
NEW_MSG="$COMMIT_MSG"$'\n\n'
while IFS= read -r contributor; do
NEW_MSG+="Co-authored-by: $contributor"$'\n'
done <<< "$CONTRIBUTORS"
# Amend the merge commit with updated message
echo "$NEW_MSG" | git commit --amend -F -
# Force push the changes
git push --force
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,26 @@ For further assistance, please create an issue on the [GitHub repository](https:

- Note for Contributors: If you would like to submit a Pull Request (PR), please target the `release` branch instead of `main`. The `release` branch is used for testing new code changes and will be periodically merged into `main` after validation. This approach ensures that only tested features make it into the main branch.

## Git Co-Authors Feature

This repository includes an automated GitHub Action that preserves contributor attribution when PRs are squashed and merged. The workflow automatically adds `Co-authored-by` lines to the squashed commit message, ensuring that all contributors get proper credit for their work.

### How it works

1. When a PR is merged, the GitHub Action triggers automatically
2. It identifies all unique contributors who made commits in the PR
3. It adds their names and emails as `Co-authored-by` lines to the final squashed commit message

### Example co-authored commit message:
```
feat: Add new feature

Co-authored-by: John Doe <[email protected]>
Co-authored-by: Jane Smith <[email protected]>
```
The workflow is configured in `.github/workflows/add-coauthors.yml`.
## Conclusion
Auto_Jobs_Applier_AIHawk provides a significant advantage in the modern job market by automating and enhancing the job application process. With features like dynamic resume generation and AI-powered personalization, it offers unparalleled flexibility and efficiency. Whether you're a job seeker aiming to maximize your chances of landing a job, a recruiter looking to streamline application submissions, or a career advisor seeking to offer better services, Auto_Jobs_Applier_AIHawk is an invaluable resource. By leveraging cutting-edge automation and artificial intelligence, this tool not only saves time but also significantly increases the effectiveness and quality of job applications in today's competitive landscape.
Expand Down

0 comments on commit fc6df4b

Please sign in to comment.