1 name: documentation cleanup
9 if: github.repository == 'cvc5/cvc5'
11 - name: Install Packages
14 sudo apt-get install -y python3 python3-jinja2
16 - name: Setup Deploy Key
18 SSH_AUTH_SOCK: /tmp/ssh_agent.sock
20 ssh-agent -a $SSH_AUTH_SOCK > /dev/null
21 ssh-add - <<< "${{ secrets.CVC5_DOCS_TOKEN }}"
23 - name: Clone docs repo
25 SSH_AUTH_SOCK: /tmp/ssh_agent.sock
27 git config --global user.email "docbot@cvc5"
28 git config --global user.name "DocBot"
29 git clone git@github.com:cvc5/docs-ci.git target/
31 - name: Remove stale docs
34 for file in `find ./ -maxdepth 1 -name "docs-*"`; do
35 mod=`git log -1 HEAD --pretty="%ai" $file`
38 find ./ -maxdepth 1 -name "docs-*" -mtime +7 -exec git rm -r {} +
39 find ./ -maxdepth 1 -name "docs-*" -xtype l -exec git rm {} +
40 git commit -m "Prune docs" || echo "Nothing to prune"
42 - name: Squash old commits
44 SSH_AUTH_SOCK: /tmp/ssh_agent.sock
47 first=`git rev-list --max-parents=0 HEAD`
48 cutoff=`date -d "-1 month" +%Y-%m-%d`
49 last=`git log --pretty='%as %H' | awk -v cutoff=$cutoff '$1 < cutoff { print $2 }' | head -n1`
50 if [ -n "$last" ]; then
52 ts=`git log -1 --format=%ct`
53 git reset --soft $first
54 if git diff --cached --exit-code
56 echo "Nothing to squash"
58 git commit -m "Squash old history" --date=$ts
60 git cherry-pick $last..main
65 SSH_AUTH_SOCK: /tmp/ssh_agent.sock
71 if git diff --cached --exit-code
73 echo "Nothing changed"
75 git commit -m "Update README.md"
78 git push -f origin HEAD:main