add seo #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| # Trigger workflow on pull requests to main branch | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| # Set permissions for CI and PR comments | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| # CI job to verify build and run tests | |
| ci: | |
| name: Build and Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Checkout repository code | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Step 2: Setup Node.js 20 with npm caching | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| # Step 3: Install dependencies using npm ci for clean, reproducible installs | |
| - name: Install dependencies | |
| run: npm ci | |
| # Step 4: Build project and verify TypeScript compilation | |
| - name: Build | |
| run: npm run build | |
| # Step 5: Run test suite using vitest | |
| - name: Test | |
| run: npm test | |
| # Step 6: Report test results with PR comment | |
| - name: Comment PR with test results | |
| if: always() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const outcome = '${{ job.status }}'; | |
| const emoji = outcome === 'success' ? '✅' : '❌'; | |
| const message = `${emoji} CI check result: **${outcome === 'success' ? 'Passed' : 'Failed'}** | |
| **Workflow**: CI | |
| **Status**: ${outcome} | |
| **Branch**: ${{ github.head_ref }} | |
| **Commit**: ${{ github.sha }} | |
| ${outcome === 'success' ? | |
| 'All tests passed and build completed successfully.' : | |
| 'Please check the logs for details and fix any issues before merging.'}`; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: message | |
| }); |