Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added co-authors #979

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "actions@github.com"

- 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
surapuramakhil marked this conversation as resolved.
Show resolved Hide resolved
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
surapuramakhil marked this conversation as resolved.
Show resolved Hide resolved

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 <john@example.com>
Co-authored-by: Jane Smith <jane@example.com>
```

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