Skip to content

Commit c0e8032

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 c0e8032

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

.github/workflows/schema-tests.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ jobs:
2424
- uses: actions/setup-node@v4 # setup Node.js
2525
with:
2626
node-version: '20.x'
27-
- name: Install dependencies
28-
run: npm i
27+
- name: Install dependencies from main
28+
run: |
29+
git checkout main -- package.json
30+
npm i
2931
- name: Run tests
3032
run: npm run test
3133

.github/workflows/validate-markdown.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@v2 # checkout repo content
22+
- name: use the javascript environment from main
23+
run: git checkout main -- package.json
2224
- uses: actions/setup-node@v4 # setup Node.js
2325
with:
2426
node-version: '14.x'

0 commit comments

Comments
 (0)