Skip to content

Commit 7f0b710

Browse files
committed
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.
1 parent 1de526f commit 7f0b710

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

.github/workflows/schema-tests.yaml

+7-3
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ jobs:
2020
runs-on: ubuntu-latest
2121

2222
steps:
23-
- uses: actions/checkout@v1 # checkout repo content
23+
- uses: actions/checkout@v4 # checkout repo content
24+
with:
25+
fetch-depth: 0
2426
- uses: actions/setup-node@v4 # setup Node.js
2527
with:
2628
node-version: '20.x'
27-
- name: Install dependencies
28-
run: npm i
29+
- name: Install dependencies from main
30+
run: |
31+
git checkout remotes/origin/main -- package.json
32+
npm i
2933
- name: Run tests
3034
run: npm run test
3135

.github/workflows/validate-markdown.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ jobs:
1818
runs-on: ubuntu-latest
1919

2020
steps:
21-
- uses: actions/checkout@v2 # checkout repo content
21+
- uses: actions/checkout@v4 # checkout repo content
22+
with:
23+
fetch-depth: 0
24+
- name: use the javascript environment from main
25+
run: |
26+
git checkout remotes/origin/main -- package.json
2227
- uses: actions/setup-node@v4 # setup Node.js
2328
with:
2429
node-version: '14.x'

0 commit comments

Comments
 (0)