Refactor: Update jwt interceptor #13
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: PR_test | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- "**" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "20.9.0" | |
- name: Install Dependencies | |
run: npm install | |
- name: Check JWT Secret | |
run: echo "JWT Secret is $JWT_SECRET" | |
env: | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
- name: Run Tests | |
run: npm test | |
env: | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
- name: If Test Fail | |
if: failure() | |
uses: actions/github-script@v4 | |
with: | |
github-token: ${{ secrets.TOKEN }} | |
script: | | |
const ref = "${{github.ref}}" | |
const pull_number = Number(ref.split("/")[2]) | |
console.log(pull_number, ref.split("/"), github.ref) | |
await github.pulls.createReview({ | |
...context.repo, | |
pull_number, | |
body: "Please check the test code again.", | |
event: "REQUEST_CHANGES" | |
}) | |
await github.pulls.update({ | |
...context.repo, | |
pull_number, | |
state: "closed" | |
}) |