From 55d5993e0c720c1bb2b9a352092de06f5463c2ab Mon Sep 17 00:00:00 2001 From: Andy Wu Date: Sat, 16 Mar 2024 10:10:01 -0700 Subject: [PATCH] [feat] add ci workflow triggered by pr --- .github/workflows/on_pr.yml | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/on_pr.yml diff --git a/.github/workflows/on_pr.yml b/.github/workflows/on_pr.yml new file mode 100644 index 0000000..136c107 --- /dev/null +++ b/.github/workflows/on_pr.yml @@ -0,0 +1,43 @@ +name: CI workflow on PR + +on: + pull_request: + branches: + - master + - main + +jobs: + + print_timestamp: + runs-on: ubuntu-latest + steps: + - name: Generate timestamp + run: | + echo "TIMESTAMP=$(TZ='America/Los_Angeles' date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV + + - name: Print timestamp + run: | + echo "Execution time (Pacific Time Zone) $TIMESTAMP" + + lint_and_test: + runs-on: ubuntu-latest + needs: print_timestamp + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + + - name: Set up Node.js + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: '20' + + - name: Install dependencies + run: npm install + + - name: Lint + run: npm run lint + + - name: Test + run: npm test +