Skip to content

Added README.md file for Maximum Subarray #91

Added README.md file for Maximum Subarray

Added README.md file for Maximum Subarray #91

Workflow file for this run

name: Add Co-Author
on:
push:
branches:
- main
permissions:
contents: write
jobs:
add-coauthor:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 2
- name: Configure Git
run: |
git config user.name "GitHub Actions Bot"
git config user.email "actions@github.com"
- name: Add co-author to latest commit
run: |
OWNER_NAME="Joshua Dierickse"
OWNER_EMAIL="joshua.dierickse@gmail.com"
# Get last commit message
MSG=$(git log -1 --pretty=%B)
AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae')
# If author or co-author not already included, amend commit
if [ "$AUTHOR_EMAIL" != "$OWNER_EMAIL" ] && ! echo "$MSG" | grep -q "Co-authored-by: $OWNER_NAME"; then
git commit --amend \
-m "$MSG" \
-m "Co-authored-by: $OWNER_NAME <$OWNER_EMAIL>" \
--no-edit
git push --force
fi