From 45b96c3de63ee8f8ece3e57cda7bb10bd5c72241 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 28 Mar 2022 15:56:55 +0100 Subject: [PATCH 1/3] Add PR check to validate compatibility with Node 12 --- .github/workflows/pr-checks.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 1369351514..bde185dad8 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -24,8 +24,31 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 45 + strategy: + fail-fast: true + matrix: + node-types-version: [12.12, current] + steps: - uses: actions/checkout@v2 + + - name: Update version of @types/node + if: matrix.node-types-version != 'current' + env: + NODE_TYPES_VERSION: ${{ matrix.node-types-version }} + run: | + export NODE_TYPES_VERSION="${NODE_TYPES_VERSION}" + contents=$(jq '.devDependencies."@types/node" = env.NODE_TYPES_VERSION' package.json) + echo "${contents}" > package.json + # Usually we need to run `npm install` on macOS, however we're not checking in the result + # here, so it's fine to run on Linux. + npm install + + git config --global user.email "github-actions@github.com" + git config --global user.name "github-actions[bot]" + git add --all + git commit -am "Use @types/node=${NODE_TYPES_VERSION}" + - name: Check generated JS run: .github/workflows/script/check-js.sh From 9e403590f456b9d05fd69181f70aa3a9010c6998 Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Mon, 28 Mar 2022 18:02:19 +0100 Subject: [PATCH 2/3] Improve code comments --- .github/workflows/pr-checks.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index bde185dad8..20b9f3d57c 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -37,11 +37,13 @@ jobs: env: NODE_TYPES_VERSION: ${{ matrix.node-types-version }} run: | + # Export `NODE_TYPES_VERSION` so it's available to jq export NODE_TYPES_VERSION="${NODE_TYPES_VERSION}" contents=$(jq '.devDependencies."@types/node" = env.NODE_TYPES_VERSION' package.json) echo "${contents}" > package.json - # Usually we need to run `npm install` on macOS, however we're not checking in the result - # here, so it's fine to run on Linux. + # Usually we run `npm install` on macOS to ensure that we pick up macOS-only dependencies. + # However we're not checking in the updated lockfile here, so it's fine to run + # `npm install` on Linux. npm install git config --global user.email "github-actions@github.com" From 2f4dd4bb4102083e4a6a3fbfec839c37d5047aec Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Tue, 29 Mar 2022 13:25:59 +0100 Subject: [PATCH 3/3] Use `git add --all .` --- .github/workflows/pr-checks.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-checks.yml b/.github/workflows/pr-checks.yml index 20b9f3d57c..e0f56a9eb1 100644 --- a/.github/workflows/pr-checks.yml +++ b/.github/workflows/pr-checks.yml @@ -48,8 +48,9 @@ jobs: git config --global user.email "github-actions@github.com" git config --global user.name "github-actions[bot]" - git add --all - git commit -am "Use @types/node=${NODE_TYPES_VERSION}" + # The period in `git add --all .` ensures that we stage deleted files too. + git add --all . + git commit -m "Use @types/node=${NODE_TYPES_VERSION}" - name: Check generated JS run: .github/workflows/script/check-js.sh