fixes the suggestion click logic of navbar #48
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: PR Auto-Check Comment | |
| on: | |
| pull_request: | |
| types: [opened, edited, synchronize] | |
| permissions: | |
| pull-requests: write | |
| contents: read | |
| jobs: | |
| add-comment: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get Changed Files | |
| id: changed-files | |
| run: | | |
| echo "files<<EOF" >> $GITHUB_OUTPUT | |
| git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| - name: Install Prettier | |
| run: npm install -g prettier | |
| - name: Check Prettier | |
| id: prettier-check | |
| run: | | |
| if npx prettier --check . 2>/dev/null; then | |
| echo "prettier_status=✅ Passed" >> $GITHUB_OUTPUT | |
| else | |
| echo "prettier_status=❌ Failed" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Add PR Comment | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const changedFiles = `${{ steps.changed-files.outputs.files }}`; | |
| const prettierStatus = `${{ steps.prettier-check.outputs.prettier_status }}`; | |
| const timestamp = new Date().toISOString(); | |
| const comment = `## 📋 PR Auto-Check\n\n### 📝 Files Changed\n\`\`\`\n${changedFiles || 'No files changed'}\n\`\`\`\n\n### ✨ Code Quality\n**Prettier Check:** ${prettierStatus}\n\n---\n*Auto-generated on ${timestamp}*`; | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: comment | |
| }); |