Skip to content

Commit 6861975

Browse files
authored
Merge pull request #3 from chriskthomas/delete-comments
Remove comments section of posts
2 parents 0be37d0 + b30340f commit 6861975

File tree

1 file changed

+5
-25
lines changed

1 file changed

+5
-25
lines changed

.github/workflows/mirror.yml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -37,34 +37,12 @@ jobs:
3737
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3838
- uses: actions/checkout@v4
3939

40-
#- name: Restore the file attrs (mtime)
41-
# run: |
42-
# if [ -d "www" ]
43-
# then
44-
# .github/bin/save-file-attrs.py restore
45-
# else
46-
# mkdir www
47-
# fi
48-
40+
# Download website
4941
- name: Download the files
5042
run: wget -m --retry-connrefused --tries=20 --no-host-directories --directory-prefix="www" --exclude-directories="/wp-json,/wp-admin" --regex-type 'pcre' --reject-regex '.*\?(?!ver).*' --wait 1 https://chriskthomas.com/
5143
- name: Download 404
5244
run: wget --content-on-error --directory-prefix="www" https://chriskthomas.com/404.html || echo "Expexted error"
5345

54-
#- name: Save the file attrs
55-
# run: .github/bin/save-file-attrs.py save
56-
57-
#- name: Commit files
58-
# run: |
59-
# git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
60-
# git config --local user.name "github-actions[bot]"
61-
# git add -- ./www
62-
# git diff-index --cached --quiet HEAD -- || git add .saved-file-attrs
63-
# git commit -m "automatically update site" || echo "Error (probably no changes to commit)"
64-
65-
#- name: Push changes
66-
# run: git push
67-
6846
- name: Setup Pages
6947
uses: actions/configure-pages@v5
7048

@@ -73,8 +51,10 @@ jobs:
7351
run: mkdir -p dist && cp -r www/* dist/
7452
- name: Remove query strings from file names
7553
run: .github/bin/cleanup-querystrings.py
76-
- name: Replace text
77-
run: find ./dist/ -type f -exec sed -i "s/https:\/\/chriskthomas.com\/\?/\//g" {} \;
54+
- name: Remove domain from URLs # breaks if you have the domain in the content or have http links
55+
run: find ./dist/ -type f -exec sed -i -E 's;(https:)?//chriskthomas.com/?;/;g' {} \;
56+
- name: Delete comments blocks in posts # breaks if you have a section inside the comments section
57+
run: find ./dist/ -type f -name 'index.html' -exec perl -i -0777pe 's;<section id="comments".*?</section>;;s' {} \;
7858
- name: Copy robots.txt
7959
run: cp robots.txt dist/
8060

0 commit comments

Comments
 (0)