Files
cs249r_book/.github/workflows/update-contributors.yml
Vijay Janapa Reddi 4c6bb387e8 refactor(workflows): complete robust path implementation across all workflows
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
2025-08-21 20:12:10 -04:00

65 lines
2.0 KiB
YAML
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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