Skip to content

Commit 72e147b

Browse files
Fix content not showing up in preview and link checker checking more than *.mdx files (#226)
* Broken link checker should only run on .mdx files * Add a test to catch a broken link * Edit a JSON file * Move to always using head.sha when link checking * Miss a place for the head.sha * print the changed files * Move back to using nick-fields/retry * Fix misspelling and add another test * Fix wrong var being pass in * Fix misspelling of variable * Found another misspelling :face_palm: * get-changed-files output is space not comma sep * Give action a clearer name * Fix dev-portal cache * Revert testing changes * Put back space
1 parent 8a0de15 commit 72e147b

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

.github/workflows/build-pr-preview.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
name: Get Changed Files
2525
runs-on: ubuntu-latest
2626
outputs:
27-
changed_content_files: ${{ steps.changed-files.outputs.content_all_changed_files }}
27+
changed_markdown_content_files: ${{ steps.changed-files.outputs.markdown_content_all_changed_files }}
28+
2829
changed_content_files_count: ${{ steps.changed-files.outputs.content_all_changed_files_count }}
2930

3031
not_content_bad_boy_naughty_files_count: ${{ steps.changed-files.outputs.not_content_bad_boy_naughty_all_changed_files_count }}
@@ -38,6 +39,8 @@ jobs:
3839
files_yaml: |
3940
content:
4041
- 'content/**'
42+
markdown_content:
43+
- 'content/**/*.mdx'
4144
not_content_bad_boy_naughty:
4245
- '!content/**'
4346
base_sha: ${{ github.event.pull_request.base.sha }}
@@ -93,6 +96,8 @@ jobs:
9396
9497
- name: Checkout hashicorp/web-unified-docs
9598
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
99+
with:
100+
ref: ${{ github.event.pull_request.head.sha }}
96101

97102
- name: Add commit link to summary
98103
run: |
@@ -186,7 +191,7 @@ jobs:
186191
with:
187192
path: |
188193
~/.npm
189-
${{ github.workspace }}/.next/cache
194+
${{ github.workspace }}/unified-docs-frontend-preview/.next/cache
190195
# Generate a new cache whenever packages or source files change.
191196
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx', '**/*.mdx') }}
192197
# If source files changed but packages didn't, rebuild from a prior cache.
@@ -213,12 +218,17 @@ jobs:
213218
echo "UNIFIED_DOCS_API=${{ needs.deploy-unified-docs-api-preview.outputs.preview_url }}" >> .env
214219
215220
- name: Build dev-portal
221+
uses: nick-fields/retry@7152eba30c6575329ac0576536151aca5a72780e # v3.0.0
216222
env:
217223
# Used to read docs from private repos, once all docs are in UDR we can remove this
218224
GITHUB_TOKEN: ${{ secrets.CI_GITHUB_TOKEN }}
219-
run: |
220-
cd unified-docs-frontend-preview
221-
vercel build --token=${{ secrets.VERCEL_TOKEN }}
225+
with:
226+
shell: bash
227+
timeout_minutes: 10
228+
max_attempts: 2
229+
command: |
230+
cd unified-docs-frontend-preview
231+
vercel build --token=${{ secrets.VERCEL_TOKEN }}
222232
223233
- name: Deploy Project Artifacts and Set GitHub Outputs
224234
id: deploy_dev_portal_preview
@@ -269,12 +279,19 @@ jobs:
269279
runs-on: ubuntu-latest
270280
steps:
271281
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
282+
with:
283+
ref: ${{ github.event.pull_request.head.sha }}
284+
285+
- name: Checking links in files
286+
run: |
287+
echo "Checking links in files:"
288+
echo "${{ needs.get-changed-files.outputs.changed_markdown_content_files }}" | tr ' ' '\n'
272289
273290
- name: Run lychee link checker
274291
id: lychee
275292
uses: lycheeverse/lychee-action@f613c4a64e50d792e0b31ec34bbcbba12263c6a6 # v2.3.0
276293
with:
277-
args: ${{ needs.get-changed-files.outputs.changed_content_files }} -b ${{ needs.deploy-dev-portal-preview.outputs.preview_url }} --exclude-all-private --exclude '\.(svg|gif|jpg|png)' --accept 200,408,429 --timeout=60 --max-concurrency 24 --no-progress --verbose
294+
args: ${{ needs.get-changed-files.outputs.changed_markdown_content_files }} -b ${{ needs.deploy-dev-portal-preview.outputs.preview_url }} --exclude-all-private --exclude '\.(svg|gif|jpg|png)' --accept 200,408,429 --timeout=60 --max-concurrency 24 --no-progress --verbose
278295
fail: false
279296
env:
280297
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)