File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212 MDBOOK_LINKCHECK_VER : 0.7.7
1313
1414jobs :
15+ # Fork may have GitHub Pages disabled, so deploying would result in 404
16+ # errors. This job checks whether Pages is enabled so the deploy job can be
17+ # skipped on repositories where it isn't configured.
18+ check-pages :
19+ runs-on : ubuntu-latest
20+ permissions :
21+ pages : read
22+ outputs :
23+ pages_enabled : ${{ steps.check_pages.outputs.is_enabled }}
24+ steps :
25+ - name : Check if GitHub Pages is enabled
26+ id : check_pages
27+ uses : AlexAegis/check-github-pages@v1
28+
1529 build :
1630 runs-on : ubuntu-latest
1731 steps :
@@ -69,13 +83,13 @@ jobs:
6983
7084 deploy :
7185 name : Deploy to GitHub pages
72- # Do not run this unless *pushing* to `master`.
73- if : github.event_name == 'push' && github.ref == 'refs/heads/master'
86+ # Do not run this unless *pushing* to `master` and GitHub Pages is enabled .
87+ if : github.event_name == 'push' && github.ref == 'refs/heads/master' && needs.check-pages.outputs.pages_enabled == 'true'
7488 environment :
7589 name : github-pages
7690 url : ${{ steps.deployment.outputs.page_url }}
7791 runs-on : ubuntu-latest
78- needs : build
92+ needs : [ build, check-pages]
7993 steps :
8094 - name : Deploy to GitHub Pages
8195 id : deployment
You can’t perform that action at this time.
0 commit comments