From c0e8032ba2ac08964d89fd2af2fe7b54cab4a99b Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Wed, 7 Feb 2024 13:36:13 -0800 Subject: [PATCH] Always checkout JavaScript environment from main Workflows run from the workflow file on main, even when they run on branches. But just running "npm i" or a command like "npx" that also installs packages uses the package.json file from the branch. Rather than attempt to keep the branch package files up-to-date (which would _quadruple_ the number of update PRs, adding three branch update PRs for every dependabot PR), let's just checkout the package.json from main whenver we run. The other workflows only run on main - these two are the ones that run on branches. --- .github/workflows/schema-tests.yaml | 6 ++++-- .github/workflows/validate-markdown.yaml | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/schema-tests.yaml b/.github/workflows/schema-tests.yaml index b9238205f2..9f66f028fc 100644 --- a/.github/workflows/schema-tests.yaml +++ b/.github/workflows/schema-tests.yaml @@ -24,8 +24,10 @@ jobs: - uses: actions/setup-node@v4 # setup Node.js with: node-version: '20.x' - - name: Install dependencies - run: npm i + - name: Install dependencies from main + run: | + git checkout main -- package.json + npm i - name: Run tests run: npm run test diff --git a/.github/workflows/validate-markdown.yaml b/.github/workflows/validate-markdown.yaml index 5825171960..909efd96a1 100644 --- a/.github/workflows/validate-markdown.yaml +++ b/.github/workflows/validate-markdown.yaml @@ -19,6 +19,8 @@ jobs: steps: - uses: actions/checkout@v2 # checkout repo content + - name: use the javascript environment from main + run: git checkout main -- package.json - uses: actions/setup-node@v4 # setup Node.js with: node-version: '14.x'