Skip to content

Commit

Permalink
Auto contributors will now try to merge with main before pushing
Browse files Browse the repository at this point in the history
  • Loading branch information
uchendui committed Sep 27, 2023
1 parent 2d7b65f commit 20ecebd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/auto-add-contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
python -m pip install --upgrade pip
pip install -r .github/workflows/contributors/requirements.txt
- name: Retrieving contributors for commit ${{ github.sha }}
- name: Retrieving all contributors from the main branch
run: |
echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
echo "🔎 Getting all contributors from the ${{ github.ref }} branch."
PUSHED_CONTRIBUTORS=$(git shortlog -sne --no-merges ${{ github.event.before }}..${{ github.sha }})
PUSHED_CONTRIBUTORS=$(git shortlog -sne --no-merges main)
echo "The contributors are: $PUSHED_CONTRIBUTORS"
- name: Running Python Script to Update .all-contributorsrc
run: |
Expand All @@ -51,6 +51,11 @@ jobs:
npx all-contributors generate
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
# Fetch the latest state of the master branch and try to merge
git fetch origin main
git merge origin/main
git add -u
git diff-index --quiet HEAD || git commit -m "Update readme and contributors.qmd with contributors"
git push
git push
5 changes: 2 additions & 3 deletions .github/workflows/contributors/update_contributors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
from github import Github
import requests

CONTRIBUTORS_TMP_FILE = 'CONTRIBUTORS_TEMP.txt'
CONTRIBUTORS_FILE = '.all-contributorsrc'

EXCLUDED_USERS = ['web-flow']
EXCLUDED_USERS = ['web-flow', 'github-actions[bot]', 'mrdragonbear']

OWNER = "harvard-edge"
REPO = "cs249r_book"
BRANCH = "auto_contributor"
BRANCH = "main"


def split_name_email(s):
Expand Down

0 comments on commit 20ecebd

Please sign in to comment.