Skip to content

Commit d95e0d8

Browse files
committed
ci: update auto-declaudeify workflow
1 parent b5a5d69 commit d95e0d8

1 file changed

Lines changed: 20 additions & 16 deletions

File tree

.github/workflows/auto-declaudeify.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,45 @@ on:
44
push:
55
branches: ['**']
66

7+
permissions:
8+
contents: write
9+
710
jobs:
811
declaudeify:
9-
if: contains(github.event.head_commit.author.name, 'Claude') || contains(github.event.head_commit.author.email, 'claude')
1012
runs-on: ubuntu-latest
1113
steps:
1214
- name: Checkout
1315
uses: actions/checkout@v4
1416
with:
1517
fetch-depth: 0
18+
token: ${{ secrets.GITHUB_TOKEN }}
1619

1720
- name: Check for Claude commits
1821
id: check
1922
run: |
2023
CLAUDE_COMMITS=$(git log --all --author="Claude" --oneline | wc -l)
2124
echo "count=$CLAUDE_COMMITS" >> $GITHUB_OUTPUT
22-
if [ $CLAUDE_COMMITS -gt 0 ]; then
25+
if [ "$CLAUDE_COMMITS" -gt 0 ]; then
2326
echo "Found $CLAUDE_COMMITS Claude commits, will filter"
27+
else
28+
echo "No Claude commits found"
2429
fi
2530
2631
- name: Filter Claude from history
27-
if: steps.check.outputs.count > 0
32+
if: steps.check.outputs.count != '0'
2833
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
3945
4046
- name: Force push filtered history
41-
if: steps.check.outputs.count > 0
47+
if: steps.check.outputs.count != '0'
4248
run: git push --all --force
43-
env:
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)