Update CI comment #77
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 Validation | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Run format check | |
| run: npm run format:check | |
| - name: Run lint check | |
| run: npm run lint:check | |
| - name: Type check | |
| run: npm run type-check | |
| - name: Post testing checklist | |
| if: success() | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| COMMENT_BODY: | | |
| <!-- pr-validation-checklist --> | |
| ## ✅ Build Successful! | |
| Please test the following before merging: | |
| - [ ] Main page | |
| - [ ] About page | |
| - [ ] Dark/Light mode toggle | |
| - [ ] Search functionality | |
| - [ ] Individual blog post | |
| - [ ] RSS feed | |
| _Last updated: TIMESTAMP_PLACEHOLDER_ | |
| run: | | |
| TIMESTAMP=$(date -u +'%Y-%m-%d %H:%M:%S UTC') | |
| FINAL_BODY="${COMMENT_BODY//TIMESTAMP_PLACEHOLDER_/$TIMESTAMP}" | |
| # Find the last comment made by github-actions bot with our marker | |
| COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \ | |
| --jq '.[] | select(.user.login == "github-actions[bot]" and (.body | contains("<!-- pr-validation-checklist -->"))) | .id' \ | |
| | tail -1) | |
| if [ -n "$COMMENT_ID" ]; then | |
| # Update existing bot comment | |
| gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID \ | |
| -X PATCH \ | |
| -f body="$FINAL_BODY" | |
| else | |
| # Create new comment if none exists | |
| gh pr comment ${{ github.event.pull_request.number }} --body "$FINAL_BODY" | |
| fi |