refactor: requiremnts workflows #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Humans should not manage requirements.txt (bots do) | |
| name: Validate requirements.txt not changed by human | |
| on: | |
| pull_request: | |
| push: | |
| jobs: | |
| reject-drift: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check if requirements.txt was modified unexpectedly | |
| run: | | |
| # Get author of last commit | |
| AUTHOR=$(git log -1 --pretty=format:'%an') | |
| # Check if requirements.txt was modified in last commit | |
| if git diff --name-only HEAD~1 HEAD | grep -q "^requirements.txt$"; then | |
| if [ "$AUTHOR" != "github-actions[bot]" ]; then | |
| echo "::error::You may NOT edit 'requirements.txt'" | |
| echo "::warning::Undo your changes to requirements.txt, so robot can maintain it." | |
| echo "::notice::To pin dependencies, use 'poetry add <package-name>'." | |
| exit 1 | |
| fi | |
| fi | |
| echo "`requirements.txt` unchanged" |