31
31
checkName : " Rebuild docker image"
32
32
ref : ${{ github.event.pull_request.head.sha }}
33
33
timeoutSeconds : 60000
34
+
35
+ - name : Get Actions user id
36
+ id : get_uid
37
+ run : |
38
+ actions_user_id=`id -u $USER`
39
+ echo $actions_user_id
40
+ echo "uid=$actions_user_id" >> $GITHUB_OUTPUT
34
41
35
42
- name : Checkout the repo
36
43
uses : actions/checkout@v2
42
49
run : |
43
50
./build_html.sh
44
51
52
+ - name : Reset ownership of workspace after build
53
+ uses : peter-murray/reset-workspace-ownership-action@v1
54
+ with :
55
+ user_id : ${{ steps.get_uid.outputs.uid }}
56
+
45
57
# Push the book's HTML to github-pages
46
58
- name : GitHub Pages action
47
59
@@ -52,11 +64,34 @@ jobs:
52
64
destination_dir : pull${{ github.event.number }}
53
65
# force_orphan: true # once peaceiris updates to v4, change this to true and keep_files: true for the PR / main branch deploy previews
54
66
67
+ - name : Checkout the gh-pages branch
68
+ uses : actions/checkout@v2
69
+ with :
70
+ fetch-depth : ' 0'
71
+ ref : ' gh-pages'
72
+
73
+ - name : Run website diff
74
+ run : |
75
+ rustup update
76
+ pip install --upgrade pip
77
+ pip install website_diff
78
+ website_diff --old dev --new pull${{ github.event.number }} --diff diff${{ github.event.number }}
79
+
80
+ - name : GitHub Pages action to push diff
81
+
82
+ with :
83
+ github_token : ${{ secrets.GITHUB_TOKEN }}
84
+ publish_dir : diff${{ github.event.number }}
85
+ keep_files : true
86
+ destination_dir : diff${{ github.event.number }}
87
+ # force_orphan: true # once peaceiris updates to v4, change this to true and keep_files: true for the PR / main branch deploy previews
88
+
55
89
- name : Post URLS to PR thread
56
90
57
91
with :
58
92
message : |
59
93
Hello! I've built a preview of your PR so that you can compare it to the current `main` branch.
60
94
* PR deploy preview available [here](https://datasciencebook.ca/pull${{ github.event.number }}/index.html)
95
+ * PR diff with `main` available [here](https://datasciencebook.ca/diff${{ github.event.number }}/index.html)
61
96
* Current `main` deploy preview available [here](https://datasciencebook.ca/dev/index.html)
62
97
* Public production build available [here](https://datasciencebook.ca)
0 commit comments