11---
22name : Deploy pull request preview
33# Setup and build files with hugo
4+ # cspell:disable-next-line
45# https://github.com/peaceiris/actions-hugo
56# Deploy to GitHub pages
67# https://github.com/peaceiris/actions-gh-pages
5657 echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
5758
5859 - name : Deploy Pull Request preview
59- uses : peaceiris/actions-gh-pages@v4
60+ uses : peaceiris/actions-gh-pages@v4 # # cspell:disable-line
6061 with :
6162 # Use GITHUB_TOKEN allowing to write to local repository
6263 github_token : ${{ secrets.GITHUB_TOKEN }}
6667 publish_branch : pr_previews
6768 # Source directory
6869 publish_dir : ./${{ steps.extract.outputs.pr_number }}/
69- # Destitnation directory
70+ # Destination directory
7071 destination_dir : ${{ steps.extract.outputs.pr_number }}
7172 # Reuse PR commit message
7273 commit_message : ${{ github.event.head_commit.message }}
@@ -86,3 +87,172 @@ jobs:
8687 repo: context.repo.repo,
8788 body: output
8889 })
90+ check_preview_links_users :
91+ env :
92+ BASE_URL : https://docs.egi.eu/documentation/users
93+ runs-on : ubuntu-latest
94+ needs :
95+ - deploy_pr_preview
96+ if : >
97+ github.event.workflow_run.event == 'pull_request' &&
98+ github.event.workflow_run.conclusion == 'success'
99+ strategy :
100+ matrix :
101+ # This matrix is built from the directories in content/en/users
102+ url :
103+ - " aai"
104+ - " compute"
105+ - " data"
106+ - " dev-env"
107+ - " getting-started"
108+ # - "machine-learning" # currently in draft
109+ - " security"
110+ - " training"
111+ - " tutorials"
112+ # cspell:disable
113+ name : Check links of preview
114+ steps :
115+ - name : Checkout configuration
116+ uses : actions/checkout@v4
117+ - name : Get tools
118+ # We will run hakrawler to crawl a page and sub-pages
119+ # Then use lychee to check whether the urls in that page are ok.
120+ run : |
121+ curl -fSL https://github.com/lycheeverse/lychee/releases/download/lychee-v0.19.1/lychee-x86_64-unknown-linux-musl.tar.gz | tar xvfz -> lychee
122+ go install github.com/hakluke/hakrawler@latest
123+ - name : Extract links and check them.
124+ # This passes a given endpoint to hakrawler, which gets all of the links
125+ # in it up to a depth of 10 (-d) and without crawling back up the tree (-i)
126+ # and returning only unique (-u) urls.
127+ # The urls are then parsed via jq to get only hrefs, no scripts
128+ # and the resulting list is sent to lyuchee via stdin (-)
129+ # to see if there are any bad links in those pages
130+ run : >-
131+ echo "https://docs.egi.eu/documentation/${{
132+ job.deploy_pr_preview.outputs.pr_number }}/users/${{ matrix.url }}" |
133+ hakrawler -u -i -d 10 -json |
134+ jq -r '. |
135+ select(.Source == "href") | .URL' |
136+ lychee -
137+ check_preview_links_internal :
138+ env :
139+ BASE_URL : https://docs.egi.eu/documentation/internal
140+ runs-on : ubuntu-latest
141+ needs :
142+ - deploy_pr_preview
143+ if : >
144+ github.event.workflow_run.event == 'pull_request' &&
145+ github.event.workflow_run.conclusion == 'success'
146+ strategy :
147+ matrix :
148+ # This matrix is built from the directories in content/en/users
149+ url :
150+ - " accounting"
151+ - " collaboration-tools"
152+ - " configuration-database"
153+ - " getting-started"
154+ - " guidelines-software-development"
155+ - " helpdesk" # cspell:disable-line
156+ - " messaging"
157+ - " monitoring"
158+ - " operations-portal"
159+ - " security-coordination"
160+ # cspell:disable
161+ name : Check links of preview
162+ steps :
163+ - name : Checkout configuration
164+ uses : actions/checkout@v4
165+ - name : Get tools
166+ # We will run hakrawler to crawl a page and sub-pages
167+ # Then use lychee to check whether the urls in that page are ok.
168+ run : |
169+ curl -fSL https://github.com/lycheeverse/lychee/releases/download/lychee-v0.19.1/lychee-x86_64-unknown-linux-musl.tar.gz | tar xvfz -> lychee
170+ go install github.com/hakluke/hakrawler@latest
171+ - name : Extract links and check them.
172+ # This passes a given endpoint to hakrawler, which gets all of the links
173+ # in it up to a depth of 10 (-d) and without crawling back up the tree (-i)
174+ # and returning only unique (-u) urls.
175+ # The urls are then parsed via jq to get only hrefs, no scripts
176+ # and the resulting list is sent to lyuchee via stdin (-)
177+ # to see if there are any bad links in those pages
178+ run : >-
179+ echo "https://docs.egi.eu/documentation/${{
180+ job.deploy_pr_preview.outputs.pr_number }}/internal/${{ matrix.url }}"
181+ |
182+ hakrawler -u -i -d 10 -json |
183+ jq -r '. |
184+ select(.Source == "href") | .URL' |
185+ lychee -
186+ check_preview_links_providers :
187+ env :
188+ BASE_URL : https://docs.egi.eu/documentation/providers
189+ runs-on : ubuntu-latest
190+ needs :
191+ - deploy_pr_preview
192+ if : >
193+ github.event.workflow_run.event == 'pull_request' &&
194+ github.event.workflow_run.conclusion == 'success'
195+ strategy :
196+ matrix :
197+ # This matrix is built from the directories in content/en/users
198+ url :
199+ - " check-in"
200+ - " cloud-compute"
201+ - " datahub" # cspell:disable-line
202+ - " high-throughput-compute"
203+ - " joining"
204+ - " notebooks"
205+ - " online-storage"
206+ - " operations-manuals"
207+ - " rod"
208+ # cspell:disable
209+ name : Check links of preview
210+ steps :
211+ - name : Checkout configuration
212+ uses : actions/checkout@v4
213+ - name : Get tools
214+ # We will run hakrawler to crawl a page and sub-pages
215+ # Then use lychee to check whether the urls in that page are ok.
216+ run : |
217+ curl -fSL https://github.com/lycheeverse/lychee/releases/download/lychee-v0.19.1/lychee-x86_64-unknown-linux-musl.tar.gz | tar xvfz -> lychee
218+ go install github.com/hakluke/hakrawler@latest
219+ - name : Extract links and check them.
220+ # This passes a given endpoint to hakrawler, which gets all of the links
221+ # in it up to a depth of 10 (-d) and without crawling back up the tree (-i)
222+ # and returning only unique (-u) urls.
223+ # The urls are then parsed via jq to get only hrefs, no scripts
224+ # and the resulting list is sent to lyuchee via stdin (-)
225+ # to see if there are any bad links in those pages
226+ run : >-
227+ echo "https://docs.egi.eu/documentation/${{
228+ job.deploy_pr_preview.outputs.pr_number }}/providers/${{ matrix.url
229+ }}" |
230+ hakrawler -u -i -d 10 -json |
231+ jq -r '. |
232+ select(.Source == "href") | .URL' |
233+ lychee -
234+ lychee-otherdocs : # cspell:disable-line
235+ env :
236+ BASE_URL : https://docs.egi.eu/
237+ name : Check links at base of the about pages
238+ strategy :
239+ matrix :
240+ url :
241+ - " "
242+ - about
243+ - support
244+ runs-on : ubuntu-latest
245+ steps :
246+ - name : Checkout code
247+ uses : actions/checkout@v4
248+
249+ - name : Get tools
250+ # On the "other" page, we do not want to crawl down, so we only use
251+ # lyuchee to check the page itself.
252+ run : |
253+ curl -fSL https://github.com/lycheeverse/lychee/releases/download/lychee-v0.19.1/lychee-x86_64-unknown-linux-musl.tar.gz | tar xvfz -> lychee
254+ - name : Check Links.
255+ run :
256+ lychee https://docs.egi.eu/documentation/${{
257+ job.deploy_pr_preview.outputs.pr_number }}/${{ matrix.url }}
258+ # cspell:enable
0 commit comments