Live Wallpaper Creator #182
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: Test Apps | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test-apps: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
- name: Install dependencies | |
run: npm install | |
- name: Test apps | |
id: test | |
continue-on-error: true | |
run: npm test | |
- name: Post test logs on failure | |
if: | | |
github.event_name == 'pull_request' && | |
(steps.test.outcome == 'failure' || failure()) | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs'); | |
let testLogs; | |
try { | |
testLogs = fs.readFileSync('test-logs.txt', 'utf8'); | |
} catch (error) { | |
testLogs = '# Test Results\n\nNo test logs found. The test script may have failed to run.'; | |
} | |
await github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: testLogs | |
}); | |
- name: Exit with test status | |
if: steps.test.outcome == 'failure' | |
run: exit 1 |