Skip to content

Commit

Permalink
Always checkout JavaScript environment from main
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
handrews committed Feb 7, 2024
1 parent 1de526f commit 7f0b710
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/schema-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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

7 changes: 6 additions & 1 deletion .github/workflows/validate-markdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 7f0b710

Please sign in to comment.