From 0ffe703c870a2ab9c7f59500a05ea66d5e795b71 Mon Sep 17 00:00:00 2001 From: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com> Date: Wed, 14 Sep 2022 13:36:31 -0700 Subject: [PATCH] feat: cache node_modules and readme --- .github/workflows/pull_requests.yml | 31 +++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index f9614b0..cd1b1f3 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -7,8 +7,27 @@ on: branches: [ master, main ] jobs: + # Run linting and tests + build-and-lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v1 + with: + node-version: 13 + - uses: ipfs/aegir/actions/cache-node-modules@master + with: + directories: | + README.md + build: | + npm run build:readme + cache_name: readme + # aegir/actions/cache-node-modules runs build. We don't need to run it again. + - run: npm run lint + update-readme: runs-on: ubuntu-latest + needs: build-and-lint if: "!contains(github.event.head_commit.message, '[skip ci]')" steps: - name: Checkout @@ -19,10 +38,13 @@ jobs: uses: actions/setup-node@v3 with: node-version: 13 - - name: Build the readme - run: | - npm install - npm run build:readme + - uses: ipfs/aegir/actions/cache-node-modules@master + with: + directories: | + README.md + build: | + npm run build:readme + cache_name: readme - name: Commit updates to README.md run: | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" @@ -35,6 +57,7 @@ jobs: with: branch: ${{ github.event.pull_request.head.ref }} github_token: ${{ secrets.GITHUB_TOKEN }} + run-danger: runs-on: ubuntu-latest needs: update-readme