4949 - name : Checkout repository
5050 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5151 with :
52- lfs : false
52+ lfs : false # LFS not needed for code checks
5353 fetch-depth : 2
5454
5555 - name : Setup dependencies
5858 build : ' false'
5959
6060 - name : Run ${{ matrix.check }}
61+ timeout-minutes : 5
6162 run : ${{ matrix.command }}
6263 continue-on-error : ${{ matrix.continue-on-error || false }}
6364
7778 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
7879 with :
7980 fetch-depth : 1
80- lfs : false
81+ lfs : false # LFS not needed for markdown link checks
8182
8283 - name : Check Markdown links (${{ matrix.extension }})
8384 uses : tcort/github-action-markdown-link-check@a800ad5f1c35bf61987946fd31c15726a1c9f2ba # v1.1.0
@@ -104,20 +105,16 @@ jobs:
104105 - name : Checkout repository
105106 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
106107 with :
107- lfs : true
108+ lfs : true # LFS required for building with images/assets
108109 fetch-depth : 2
109110
110111 - name : Set base URL for build
111112 id : set-base-url
112113 run : |
113114 # Set base URL for PR preview builds (excluding Dependabot)
114115 if [ "${{ github.actor }}" != "dependabot[bot]" ]; then
115- # Validate PR number is numeric
116+ # PR number is validated by GitHub and guaranteed to be numeric
116117 pr_number="${{ github.event.pull_request.number }}"
117- if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then
118- echo "Error: Invalid PR number: $pr_number"
119- exit 1
120- fi
121118 echo "build_base_url=/pr-preview/pr-${pr_number}/" >> $GITHUB_OUTPUT
122119 echo "Building with PR preview URL: /pr-preview/pr-${pr_number}/"
123120 else
@@ -136,7 +133,7 @@ jobs:
136133 with :
137134 name : build-artifacts
138135 path : ./build/
139- retention-days : 1
136+ retention-days : 7 # Increased from 1 day for debugging purposes
140137 compression-level : 9
141138
142139 # Deploy preview only for non-Dependabot PRs from the main repo (not forks)
@@ -158,7 +155,7 @@ jobs:
158155 with :
159156 ref : gh-pages
160157 fetch-depth : 1
161- lfs : false
158+ lfs : false # LFS not needed for gh-pages management
162159
163160 - name : Download build artifacts
164161 uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
@@ -167,20 +164,21 @@ jobs:
167164 path : ./build/
168165
169166 - name : Deploy preview to gh-pages
167+ timeout-minutes : 5
170168 run : |
169+ # Validate PR number is numeric
170+ if [[ ! "${{ github.event.pull_request.number }}" =~ ^[0-9]+$ ]]; then
171+ echo "Error: Invalid PR number: ${{ github.event.pull_request.number }}"
172+ exit 1
173+ fi
174+
171175 # Configure git
172176 git config user.name "github-actions[bot]"
173177 git config user.email "github-actions[bot]@users.noreply.github.com"
174178
175179 # Setup preview directory
176180 preview_dir="pr-preview/pr-${{ github.event.pull_request.number }}"
177181
178- # Validate PR number and directory path
179- if ! [[ "${{ github.event.pull_request.number }}" =~ ^[0-9]+$ ]]; then
180- echo "Error: Invalid PR number: ${{ github.event.pull_request.number }}"
181- exit 1
182- fi
183-
184182 # Ensure preview directory is within pr-preview folder
185183 if [[ "${preview_dir}" != pr-preview/pr-* ]]; then
186184 echo "Error: Invalid preview directory path: ${preview_dir}"
@@ -304,23 +302,24 @@ jobs:
304302 with :
305303 ref : gh-pages
306304 fetch-depth : 1
307- lfs : false
305+ lfs : false # LFS not needed for gh-pages management
308306
309307 - name : Remove preview directory
308+ timeout-minutes : 5
310309 run : |
310+ # Validate PR number is numeric
311+ if [[ ! "${{ github.event.pull_request.number }}" =~ ^[0-9]+$ ]]; then
312+ echo "Error: Invalid PR number: ${{ github.event.pull_request.number }}"
313+ exit 1
314+ fi
315+
311316 # Configure git
312317 git config user.name "github-actions[bot]"
313318 git config user.email "github-actions[bot]@users.noreply.github.com"
314319
315320 # Remove preview directory
316321 preview_dir="pr-preview/pr-${{ github.event.pull_request.number }}"
317322
318- # Validate PR number and directory path before removal
319- if ! [[ "${{ github.event.pull_request.number }}" =~ ^[0-9]+$ ]]; then
320- echo "Error: Invalid PR number: ${{ github.event.pull_request.number }}"
321- exit 1
322- fi
323-
324323 # Ensure we're only removing from pr-preview folder
325324 if [[ "${preview_dir}" != pr-preview/pr-* ]]; then
326325 echo "Error: Invalid preview directory path: ${preview_dir}"
0 commit comments