feat: logout, machines, agents --all, run agent@machine #4
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: [master] | |
| types: [opened, synchronize, reopened] | |
| concurrency: | |
| group: pr-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| validate: | |
| name: Validate Pull Request | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| id: install | |
| run: npm ci | |
| - name: Type check | |
| id: type-check | |
| if: always() && steps.install.outcome == 'success' | |
| run: npm run type-check | |
| - name: Lint | |
| id: lint | |
| if: always() && steps.install.outcome == 'success' | |
| run: npm run lint | |
| - name: Format check | |
| id: format | |
| if: always() && steps.install.outcome == 'success' | |
| run: npm run format:check | |
| - name: Test | |
| id: test | |
| if: always() && steps.install.outcome == 'success' | |
| run: npm run test | |
| - name: Build | |
| id: build | |
| if: always() && steps.install.outcome == 'success' | |
| run: npm run build | |
| - name: Comment on PR | |
| if: always() | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const marker = '<!-- pr-validation-bot -->'; | |
| const checks = [ | |
| { name: 'Dependencies installed', outcome: '${{ steps.install.outcome }}' }, | |
| { name: 'Type check passed', outcome: '${{ steps.type-check.outcome }}' }, | |
| { name: 'Linting passed', outcome: '${{ steps.lint.outcome }}' }, | |
| { name: 'Format check passed', outcome: '${{ steps.format.outcome }}' }, | |
| { name: 'Tests passed', outcome: '${{ steps.test.outcome }}' }, | |
| { name: 'Build successful', outcome: '${{ steps.build.outcome }}' }, | |
| ]; | |
| const allPassed = checks.every(c => c.outcome === 'success'); | |
| const status = allPassed ? '✅ PASSED' : '❌ FAILED'; | |
| const emoji = allPassed ? '🎉' : '💥'; | |
| const checkLines = checks | |
| .map(c => `- ${c.outcome === 'success' ? '✅' : c.outcome === 'skipped' ? '⏭️' : '❌'} ${c.name}`) | |
| .join('\n'); | |
| const body = `${marker} | |
| ${emoji} **PR Validation ${status}** | |
| **Commit:** \`${{ github.event.pull_request.head.sha }}\` | |
| **Branch:** \`${{ github.head_ref }}\` | |
| **Checks:** | |
| ${checkLines} | |
| ${allPassed ? '**Ready to merge!** ✨' : '**Please fix the failing checks.**'} | |
| --- | |
| 🔗 [View workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| ⏰ Generated at: \`${new Date().toISOString()}\``; | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => | |
| c.user.login === 'github-actions[bot]' && c.body.startsWith(marker) | |
| ); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body: body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: body, | |
| }); | |
| } |