build(deps): standardize dependabot config and enable auto-merge #33
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: Lighthouse CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| lighthouse: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: taiki-e/install-action@42721ded7ddc3cd90f687527e8602066e4e1ff3a # v2.69.2 | |
| with: | |
| tool: just | |
| - name: Setup Node.js | |
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 | |
| with: | |
| node-version: 'lts/*' | |
| - name: Run Lighthouse | |
| id: lighthouse | |
| run: just lighthouse | |
| - name: Load results for PR comment | |
| if: always() && github.event_name == 'pull_request' | |
| run: | | |
| echo "LIGHTHOUSE_RESULTS<<EOF" >> $GITHUB_ENV | |
| cat /tmp/lighthouse-results.md >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| - name: Comment on pull request with results | |
| if: always() && github.event_name == 'pull_request' | |
| uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 | |
| with: | |
| script: | | |
| const fs = require("fs"); | |
| const results = process.env.LIGHTHOUSE_RESULTS || "No results available"; | |
| const status = '${{ steps.lighthouse.outcome }}' === 'success' ? '✅ PASSED' : '⚠️ NEEDS IMPROVEMENT'; | |
| const template = fs.readFileSync(".github/comment-templates/lighthouse-report.md", "utf8"); | |
| const body = template.replace("{{status}}", status).replace("{{results}}", results); | |
| const marker = "<!-- lighthouse-report -->"; | |
| const bodyWithMarker = marker + "\n" + body; | |
| 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.body.includes(marker)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body: bodyWithMarker, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body: bodyWithMarker, | |
| }); | |
| } |