Skip to content

Commit

Permalink
chore/add pr-test-action
Browse files Browse the repository at this point in the history
  • Loading branch information
ishiko732 committed Nov 20, 2023
1 parent 899e7f6 commit 098082a
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ name: Publish Package to npm.js
on:
release:
types: [published]
push:
branches:
- master
repository_dispatch:
types: [publish-npm]

jobs:

Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/pr-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: PR Test

on:
pull_request:
branches:
- master

jobs:
test:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 16

- uses: pnpm/[email protected]
with:
version: 8.7.1

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Run tests
run: pnpm test

- name: jest coverage report
uses: ArtiomTr/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Check test status
id: test-status
run: echo "::set-output name=status::$(if grep -q 'Test failed' test-results.txt; then echo 'failure'; else echo 'success'; fi)"

merge:
needs: test
runs-on: ubuntu-latest
if: ${{ needs.test.outputs.status == 'success' }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Trigger npm-publish workflow
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ishiko732/ts-fsrs
event-type: publish-npm

0 comments on commit 098082a

Please sign in to comment.