Skip to content

fix: address Copilot code review feedback #6

fix: address Copilot code review feedback

fix: address Copilot code review feedback #6

name: PR Preview & Checks
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
validate-localization:
name: Validate Localization
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Validate Localization
run: npm run l10n:validate
build-preview:
name: Build Preview
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build VSIX
run: yarn package
- name: Get VSIX filename
id: vsix
run: |
VSIX_FILE=$(ls *.vsix | head -n 1)
echo "filename=$VSIX_FILE" >> $GITHUB_OUTPUT
echo "basename=$(basename $VSIX_FILE .vsix)" >> $GITHUB_OUTPUT
- name: Create ZIP package
run: |
zip -j ${{ steps.vsix.outputs.basename }}.zip ${{ steps.vsix.outputs.filename }}
- name: Upload preview artifact
uses: actions/upload-artifact@v4
with:
name: pr-preview-${{ github.event.pull_request.number }}
path: ${{ steps.vsix.outputs.basename }}.zip
retention-days: 30
- name: Comment on PR
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const prNumber = context.payload.pull_request.number;
const runId = context.runId;
const repo = context.repo;
const message = `## 🚀 Preview Build Ready!
A preview build has been generated for this PR. You can download and test it:
**📦 Download:** [pr-preview-${prNumber}.zip](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})
### Installation Instructions:
1. Download the zip file from the link above (click on "pr-preview-${prNumber}" in the Artifacts section)
2. Extract the .vsix file
3. In VS Code, go to Extensions view
4. Click "..." menu → "Install from VSIX..."
5. Select the extracted .vsix file
---
*Build: ${context.sha.substring(0, 7)} • [View workflow run](https://github.com/${repo.owner}/${repo.repo}/actions/runs/${runId})*`;
github.rest.issues.createComment({
owner: repo.owner,
repo: repo.repo,
issue_number: prNumber,
body: message
});