ci: update declaudeify to strip co-author trailers #3
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
| name: Auto-Declaudeify | |
| on: | |
| push: | |
| branches: ['**'] | |
| permissions: | |
| contents: write | |
| jobs: | |
| declaudeify: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check for Claude traces | |
| id: check | |
| run: | | |
| AUTHOR_COMMITS=$(git log --all --author="Claude" --oneline | wc -l) | |
| COAUTHOR_COMMITS=$(git log --all --grep="Co-Authored-By.*[Cc]laude" --oneline | wc -l) | |
| TOTAL=$((AUTHOR_COMMITS + COAUTHOR_COMMITS)) | |
| echo "count=$TOTAL" >> $GITHUB_OUTPUT | |
| echo "Found $AUTHOR_COMMITS author commits, $COAUTHOR_COMMITS co-author commits" | |
| - name: Remove Claude from history | |
| if: steps.check.outputs.count != '0' | |
| run: | | |
| git config user.name "lanmower" | |
| git config user.email "lanmower@lanmower.com" | |
| git filter-branch --force \ | |
| --env-filter ' | |
| if [ "$GIT_AUTHOR_NAME" = "Claude" ]; then | |
| export GIT_AUTHOR_NAME="lanmower" | |
| export GIT_AUTHOR_EMAIL="lanmower@lanmower.com" | |
| fi | |
| if [ "$GIT_COMMITTER_NAME" = "Claude" ]; then | |
| export GIT_COMMITTER_NAME="lanmower" | |
| export GIT_COMMITTER_EMAIL="lanmower@lanmower.com" | |
| fi' \ | |
| --msg-filter 'sed "/^Co-[Aa]uthored-[Bb]y:.*[Cc]laude/d"' \ | |
| --tag-name-filter cat -- --all | |
| - name: Force push filtered history | |
| if: steps.check.outputs.count != '0' | |
| run: git push --all --force |