Nightly Prettier Latest #26
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: Nightly Prettier Latest | |
| on: | |
| schedule: | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| test-prettier-latest: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| cache: 'pnpm' | |
| - run: pnpm add -D prettier@latest -w | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm test | |
| - name: Create or comment on issue | |
| if: failure() | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const issueTitle = 'Nightly Prettier Latest Test Failed'; | |
| // Search for existing open issue | |
| const issues = await github.rest.issues.listForRepo({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'open', | |
| labels: ['automated', 'test-failure'] | |
| }); | |
| const existingIssue = issues.data.find(issue => issue.title === issueTitle); | |
| const body = `Test failed on run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| **Commit:** ${{ github.sha }} | |
| **Date:** ${new Date().toISOString()}`; | |
| if (existingIssue) { | |
| // Add comment to existing issue | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: existingIssue.number, | |
| body: body | |
| }); | |
| } else { | |
| // Create new issue | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: issueTitle, | |
| body: body, | |
| labels: ['automated', 'test-failure'] | |
| }); | |
| } |