mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-04-27 01:49:49 -05:00
Updated remaining workflows to use github.workspace absolute paths:
fix_casing.yml:
- tools/scripts/maintenance/generate_casing_fix_script.py
- → ${{ github.workspace }}/tools/scripts/maintenance/generate_casing_fix_script.py
update-contributors.yml:
- .github/workflows/contributors/update_contributors.py
- → ${{ github.workspace }}/.github/workflows/contributors/update_contributors.py
All workflows now use consistent, robust absolute paths that:
- Eliminate fragile relative path calculations
- Follow GitHub Actions best practices
- Are maintainable and explicit
- Work regardless of directory structure changes
65 lines
2.0 KiB
YAML
65 lines
2.0 KiB
YAML
name: '👥 Update Contributors'
|
||
|
||
on:
|
||
workflow_call:
|
||
workflow_dispatch:
|
||
|
||
jobs:
|
||
update-contributors:
|
||
name: Update Contributors List
|
||
runs-on: ubuntu-latest
|
||
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v4
|
||
with:
|
||
fetch-depth: 0
|
||
|
||
- name: Setup Python
|
||
uses: actions/setup-python@v4
|
||
with:
|
||
python-version: '3.11'
|
||
cache: 'pip'
|
||
|
||
- name: Install dependencies
|
||
run: |
|
||
python -m pip install --upgrade pip
|
||
pip install -r tools/dependencies/requirements.txt
|
||
pip install PyGithub>=1.55
|
||
|
||
- name: Configure Git
|
||
run: |
|
||
git config --global user.name "github-actions[bot]"
|
||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||
|
||
- name: Update contributors (script)
|
||
run: python ${{ github.workspace }}/.github/workflows/contributors/update_contributors.py --api-key ${{ secrets.GITHUB_TOKEN }}
|
||
|
||
- name: Update contributors (cli)
|
||
run: npx --yes all-contributors-cli generate
|
||
|
||
- name: Check for changes
|
||
id: update
|
||
run: |
|
||
if git status .all-contributorsrc README.md --porcelain | grep .; then
|
||
echo "changes_made=true" >> $GITHUB_OUTPUT
|
||
else
|
||
echo "changes_made=false" >> $GITHUB_OUTPUT
|
||
fi
|
||
|
||
- name: Commit Changes
|
||
if: steps.update.outputs.changes_made == 'true'
|
||
run: |
|
||
BRANCH_NAME=${GITHUB_HEAD_REF:-$(git rev-parse --abbrev-ref HEAD)}
|
||
|
||
git add .all-contributorsrc README.md
|
||
git commit -m "Update contributors list [skip ci]"
|
||
git push origin "$BRANCH_NAME"
|
||
|
||
- name: Report Status
|
||
run: |
|
||
if [ "${{ steps.update.outputs.changes_made }}" = "true" ]; then
|
||
echo "✅ Contributors list has been updated"
|
||
else
|
||
echo "ℹ️ No changes were needed for contributors list"
|
||
fi |