Skip to content

Run test workflow automatically #19

Run test workflow automatically

Run test workflow automatically #19

Workflow file for this run

name: Test Workflow
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install pnpm
uses: pnpm/action-setup@v5
with:
version: 10
- name: Use Node.js
uses: actions/setup-node@v5
with:
node-version: 24.14.0
cache: 'pnpm'
- name: Install Dependencies
run: pnpm i
- name: Generate SvelteKit config
run: pnpm svelte-kit sync
- name: Update and Test database
env:
DB_URL: file:database/local.db
DB_VISITS_URL: file:database/visits.db
run: pnpm db:update
- name: Find Comment
if: ${{ always() && github.event_name == 'pull_request' }}
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: Test Workflow Status
- name: Create or update comment
if: ${{ always() && github.event_name == 'pull_request' }}
uses: peter-evans/create-or-update-comment@v5
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
edit-mode: replace
body: |
<!-- Test Workflow Status -->
${{ job.status == 'success' && 'Tests have passed ✅'
|| '⚠️ Automated testing for this pull request has failed. Please examine the run logs to identify the root cause of the error. Additional information regarding these tests can be found in the [contribution guidelines](https://github.com/ScriptRaccoon/CatDat/blob/main/CONTRIBUTING.md).' }}