@@ -75,20 +75,20 @@ You are a documentation testing specialist. Your task is to build the project's
7575- ** Repository** : ${{ github.repository }}
7676- ** Run ID** : ${{ github.run_id }}
7777- ** Triggered by** : @${{ github.actor }}
78- - ** Devices to test** : ${{ inputs.devices || 'mobile,tablet,desktop' }}
79- - ** Docs directory** : ${{ inputs.docs_dir || 'docs' }}
80- - ** Build command** : ${{ inputs.build_command || 'npm run build' }}
81- - ** Serve command** : ${{ inputs.serve_command || 'npm run preview' }}
82- - ** Server port** : ${{ inputs.server_port || '4321' }}
78+ - ** Devices to test** (DEVICES) : ${{ inputs.devices }} (default: 'mobile,tablet,desktop')
79+ - ** Docs directory** (DOCS_DIR) : ${{ inputs.docs_dir }} (default: 'docs' )
80+ - ** Build command** (BUILD_COMMAND) : ${{ inputs.build_command }} (default 'npm run build' )
81+ - ** Serve command** (SERVE_COMMAND) : ${{ inputs.serve_command }} (default 'npm run preview')
82+ - ** Server port** (SERVER_PORT) : ${{ inputs.server_port }} (default '4321')
8383- ** Working directory** : ${{ github.workspace }}
8484
8585## Step 1: Verify the Documentation Site Exists
8686
8787Check that the documentation directory exists and has a package.json:
8888
8989``` bash
90- ls -la ${{ github.workspace } }/${{ inputs.docs_dir || ' docs ' } } /
91- cat ${{ github.workspace } }/${{ inputs.docs_dir || ' docs ' } } /package.json 2> /dev/null | head -20 || echo " No package.json found"
90+ ls -la ${{ github.workspace } }/DOCS_DIR /
91+ cat ${{ github.workspace } }/DOCS_DIR /package.json 2> /dev/null | head -20 || echo " No package.json found"
9292```
9393
9494If the docs directory doesn't exist or has no package.json, call the ` noop ` safe output explaining that this repository doesn't have a buildable documentation site and stop.
@@ -98,9 +98,9 @@ If the docs directory doesn't exist or has no package.json, call the `noop` safe
9898Navigate to the docs directory and build the site:
9999
100100``` bash
101- cd ${{ github.workspace } }/${{ inputs.docs_dir || ' docs ' } }
101+ cd ${{ github.workspace } }/DOCS_DIR
102102npm install
103- ${{ inputs.build_command || ' npm run build ' } }
103+ BUILD_COMMAND
104104```
105105
106106If the build fails, create a GitHub issue titled "📱 Multi-Device Docs Test Failed - Build Error" with the error details and stop.
@@ -110,16 +110,16 @@ If the build fails, create a GitHub issue titled "📱 Multi-Device Docs Test Fa
110110Start the preview server in the background and wait for it to be ready:
111111
112112``` bash
113- cd ${{ github.workspace } }/${{ inputs.docs_dir || ' docs ' } }
114- ${{ inputs.serve_command || ' npm run preview ' } } > /tmp/docs-preview.log 2>&1 &
113+ cd ${{ github.workspace } }/DOCS_DIR
114+ SERVE_COMMAND > /tmp/docs-preview.log 2>&1 &
115115echo $! > /tmp/docs-server.pid
116116echo " Server started with PID: $( cat /tmp/docs-server.pid) "
117117```
118118
119119Wait for the server to be ready:
120120
121121``` bash
122- PORT=${{ inputs.server_port || ' 4321 ' } }
122+ PORT=SERVER_PORT
123123for i in {1..30}; do
124124 curl -s http://localhost:$PORT > /dev/null && echo " Server ready on port $PORT !" && break
125125 echo " Waiting for server... ($i /30)" && sleep 2
@@ -129,7 +129,7 @@ curl -s http://localhost:$PORT > /dev/null || echo "WARNING: Server may not have
129129
130130## Step 4: Device Configuration
131131
132- Use these viewport sizes based on the ` ${{ inputs.devices || 'mobile,tablet,desktop' }} ` input:
132+ Use these viewport sizes based on the ` DEVICES ` input:
133133
134134** Mobile devices** (test if "mobile" in input):
135135- iPhone 12: 390×844
@@ -157,7 +157,7 @@ For **each device viewport** in the requested device types, perform the followin
157157mcp__playwright__browser_run_code ({
158158 code: ` async (page) => {
159159 await page.setViewportSize({ width: 390, height: 844 });
160- await page.goto('http://localhost:${ { inputs . server_port || ' 4321 ' } } /');
160+ await page.goto('http://localhost:SERVER_PORT /');
161161 return { url: page.url(), title: await page.title() };
162162 }`
163163})
0 commit comments