Add Catnip Feature #41
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: PR Validation | |
| on: | |
| pull_request: | |
| branches: [main] | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| validate: | |
| name: Validate PR | |
| uses: ./.github/workflows/build.yml | |
| with: | |
| checkout-ref: ${{ github.event.pull_request.head.sha }} | |
| permissions: | |
| contents: read | |
| report-status: | |
| name: Report Validation Status | |
| runs-on: ubuntu-latest | |
| needs: validate | |
| if: always() | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Report Status | |
| uses: actions/github-script@v7 | |
| with: | |
| retries: 3 | |
| retry-exempt-status-codes: 400,401,403,404,422 | |
| script: | | |
| const status = '${{ needs.validate.result }}'; | |
| const icon = status === 'success' ? '✅' : '❌'; | |
| const message = status === 'success' | |
| ? 'All checks passed! Ready for review.' | |
| : 'Some checks failed. Please review the errors above.'; | |
| // Build check list with actual results | |
| const checks = [ | |
| '✓ Linting', | |
| '✓ Spell check (source)', | |
| '✓ Type checking & Build', | |
| '✓ Spell check (HTML)', | |
| '✓ Internal link validation', | |
| '✓ Artifact upload' | |
| ]; | |
| const checkList = status === 'success' | |
| ? checks.join('\n') | |
| : 'Please check the workflow logs for details on which checks failed.'; | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: `## PR Validation ${icon}\n\n${message}\n\n### Checks Performed:\n${checkList}\n\n*This is a complete dry-run of the deployment process, ensuring your changes will deploy successfully when merged.*` | |
| }); |