From 7f0b71027291f519b97e4df607263f1ddf38b4e6 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 | 10 +++++++--- .github/workflows/validate-markdown.yaml | 7 ++++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/schema-tests.yaml b/.github/workflows/schema-tests.yaml index b9238205f2..b423303aae 100644 --- a/.github/workflows/schema-tests.yaml +++ b/.github/workflows/schema-tests.yaml @@ -20,12 +20,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 # checkout repo content + - uses: actions/checkout@v4 # checkout repo content + with: + fetch-depth: 0 - 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 remotes/origin/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..bc5e757315 100644 --- a/.github/workflows/validate-markdown.yaml +++ b/.github/workflows/validate-markdown.yaml @@ -18,7 +18,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 # checkout repo content + - uses: actions/checkout@v4 # checkout repo content + with: + fetch-depth: 0 + - name: use the javascript environment from main + run: | + git checkout remotes/origin/main -- package.json - uses: actions/setup-node@v4 # setup Node.js with: node-version: '14.x'