From 38deb6715e9557e944393a913b57e8086eb1005b Mon Sep 17 00:00:00 2001 From: Kshitij Chauhan Date: Fri, 5 Apr 2024 20:17:05 +0100 Subject: [PATCH] Prevent duplicate workflow runs on PRs (#2) --- .github/workflows/build.yaml | 7 ++++--- .github/workflows/pr.yaml | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pr.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e67363c..eef6ab7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,8 +1,9 @@ name: Build on: - - push - - pull_request + push: + branches: + - "main" jobs: build: @@ -15,5 +16,5 @@ jobs: node-version: 20.x cache: "npm" - run: npm ci - - run: npm run build --if-present + - run: npm run build - run: npm test diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..332cebe --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,18 @@ +name: Build + +on: + - pull_request + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: 20.x + cache: "npm" + - run: npm ci + - run: npm run build + - run: npm test