|
4 | 4 | push: |
5 | 5 | branches: ['**'] |
6 | 6 |
|
| 7 | +permissions: |
| 8 | + contents: write |
| 9 | + |
7 | 10 | jobs: |
8 | 11 | declaudeify: |
9 | | - if: contains(github.event.head_commit.author.name, 'Claude') || contains(github.event.head_commit.author.email, 'claude') |
10 | 12 | runs-on: ubuntu-latest |
11 | 13 | steps: |
12 | 14 | - name: Checkout |
13 | 15 | uses: actions/checkout@v4 |
14 | 16 | with: |
15 | 17 | fetch-depth: 0 |
| 18 | + token: ${{ secrets.GITHUB_TOKEN }} |
16 | 19 |
|
17 | 20 | - name: Check for Claude commits |
18 | 21 | id: check |
19 | 22 | run: | |
20 | 23 | CLAUDE_COMMITS=$(git log --all --author="Claude" --oneline | wc -l) |
21 | 24 | echo "count=$CLAUDE_COMMITS" >> $GITHUB_OUTPUT |
22 | | - if [ $CLAUDE_COMMITS -gt 0 ]; then |
| 25 | + if [ "$CLAUDE_COMMITS" -gt 0 ]; then |
23 | 26 | echo "Found $CLAUDE_COMMITS Claude commits, will filter" |
| 27 | + else |
| 28 | + echo "No Claude commits found" |
24 | 29 | fi |
25 | 30 |
|
26 | 31 | - name: Filter Claude from history |
27 | | - if: steps.check.outputs.count > 0 |
| 32 | + if: steps.check.outputs.count != '0' |
28 | 33 | run: | |
29 | | - git filter-branch --force --env-filter \ |
30 | | - 'if [ "$GIT_AUTHOR_NAME" = "Claude" ]; then \ |
31 | | - export GIT_AUTHOR_NAME="lanmower"; \ |
32 | | - export GIT_AUTHOR_EMAIL="lanmower@lanmower.com"; \ |
33 | | - fi; \ |
34 | | - if [ "$GIT_COMMITTER_NAME" = "Claude" ]; then \ |
35 | | - export GIT_COMMITTER_NAME="lanmower"; \ |
36 | | - export GIT_COMMITTER_EMAIL="lanmower@lanmower.com"; \ |
37 | | - fi' \ |
38 | | - --tag-name-filter cat -- --all |
| 34 | + git config user.name "lanmower" |
| 35 | + git config user.email "lanmower@lanmower.com" |
| 36 | + git filter-branch --force --env-filter ' |
| 37 | + if [ "$GIT_AUTHOR_NAME" = "Claude" ]; then |
| 38 | + export GIT_AUTHOR_NAME="lanmower" |
| 39 | + export GIT_AUTHOR_EMAIL="lanmower@lanmower.com" |
| 40 | + fi |
| 41 | + if [ "$GIT_COMMITTER_NAME" = "Claude" ]; then |
| 42 | + export GIT_COMMITTER_NAME="lanmower" |
| 43 | + export GIT_COMMITTER_EMAIL="lanmower@lanmower.com" |
| 44 | + fi' --tag-name-filter cat -- --all |
39 | 45 |
|
40 | 46 | - name: Force push filtered history |
41 | | - if: steps.check.outputs.count > 0 |
| 47 | + if: steps.check.outputs.count != '0' |
42 | 48 | run: git push --all --force |
43 | | - env: |
44 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
|
0 commit comments