From c0fc5649a1c007ee768680f2c21da298ca4d18b7 Mon Sep 17 00:00:00 2001 From: Braulio Rivas Abad Date: Wed, 5 Jun 2024 15:35:35 -0500 Subject: [PATCH] create separate file for filter + run previews only if test passes --- .github/workflows/preview.yml | 6 ++++++ .github/workflows/test-previews.yml | 26 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/test-previews.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index cb73cebe..aa4958ee 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -9,7 +9,13 @@ on: - closed jobs: + test: + uses: key4hep/dmx/.github/workflows/test-previews.yml@main + with: + repository: ${{ github.event.pull_request.head.sha }} + deploy-preview: + needs: test environment: github-pages runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/test-previews.yml b/.github/workflows/test-previews.yml new file mode 100644 index 00000000..f0fad80a --- /dev/null +++ b/.github/workflows/test-previews.yml @@ -0,0 +1,26 @@ +name: Test previews +on: + workflow_call: + inputs: + repository: + required: true + type: string + +jobs: + test: + environment: github-pages + runs-on: ubuntu-latest + steps: + - name: Checkout PR + uses: actions/checkout@v3 + with: + ref: ${{ inputs.repository }} + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20.x" + cache: "npm" + - name: Install dependencies + run: npm install + - name: Run tests + run: npm test