feat(DeleteItem): Add deletion of goals, microgoals, and tasks #28
Workflow file for this run
This file contains 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: Firebase Preview Deploy | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
deploy-preview: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pull-requests: write | |
issues: write | |
steps: | |
- name: ๐ฅ Checkout code | |
uses: actions/checkout@v4 | |
- name: ๐ฆ Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: 'npm' | |
- name: ๐ Install dependencies | |
run: npm ci | |
- name: ๐จ Build the app | |
run: npm run build | |
- name: ๐งช Test the app with Vitest | |
run: npm run test:ci | tee test-results.txt | |
# ๐ฎ Clean up test results for comment | |
- name: ๐ฎ Clean up test results | |
run: sed -i 's/\x1b\[[0-9;]*m//g' test-results.txt # Removes ANSI color codes | |
# ๐ Format test results for better readability | |
- name: ๐ Format test results | |
run: | | |
{ | |
echo "### ๐งช Test Results" | |
echo "" | |
if grep -q "failed" test-results.txt; then | |
# Extract failed test details if any | |
echo "โ **Some tests failed**:" | |
echo '```' | |
grep -E "Test Files|Tests|Duration|failed" test-results.txt | |
echo '```' | |
echo "" | |
echo "๐ฅ Please review the failed tests above." | |
else | |
# Format output for passing tests | |
grep -E "(Test Files|Tests|Duration)" test-results.txt | while read -r line; do | |
if [[ $line == *"Test Files"* ]]; then | |
echo "๐ **Test Summary**: $line" | |
elif [[ $line == *"Tests"* ]]; then | |
echo "โ **Tests Passed**: $line" | |
elif [[ $line == *"Duration"* ]]; then | |
echo "โฑ๏ธ **Total Duration**: $line" | |
fi | |
done | |
echo "" | |
echo "๐ All tests passed successfully!" | |
fi | |
} > formatted-results.txt | |
- name: ๐ Install Firebase CLI | |
run: npm install -g firebase-tools | |
- name: ๐ Deploy to Firebase Preview Channel | |
id: firebase_deploy | |
env: | |
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | |
run: | | |
firebase hosting:channel:deploy pr-${{ github.event.number }} --expires 2d | tee deploy-output.txt | |
- name: ๐ Extract Preview URL | |
id: extract_url | |
run: | | |
URL=$(grep -oP 'https:\/\/[^\s]+pr-${{ github.event.number }}[^\s]+' deploy-output.txt) | |
echo "PREVIEW_URL=${URL}" >> $GITHUB_ENV | |
- name: ๐ฌ Post test results and preview link to PR | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const previewUrl = process.env.PREVIEW_URL; | |
const fs = require('fs'); | |
const testResults = fs.readFileSync('formatted-results.txt', 'utf8'); | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `๐ Preview for this PR is available at: ${previewUrl} \n\n ${testResults}` | |
}); |