From dea407874bad4ca2dce76e5ceeeae3ff622cb3b0 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 12:33:15 -0500 Subject: [PATCH 01/20] fix(coverage): update node version installation step, update coverage report --- .github/actions/setup-node/action.yml | 57 +++++++++++++++++++++++++ .github/workflows/push_code_linting.yml | 23 +++++----- .github/workflows/test.yml | 25 ++++------- .ncurc.yml | 1 - .npmrc | 2 - package-lock.json | 2 +- package.json | 3 +- scripts/latest_valid_node_version.sh | 8 ++++ vitest.config.ts | 4 +- 9 files changed, 93 insertions(+), 32 deletions(-) create mode 100644 .github/actions/setup-node/action.yml create mode 100755 scripts/latest_valid_node_version.sh diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml new file mode 100644 index 00000000..b76ed4e4 --- /dev/null +++ b/.github/actions/setup-node/action.yml @@ -0,0 +1,57 @@ +name: Setup Node +description: Sets up Node.js environment + +inputs: + version: + description: 'The version of Node.js to use' + default: 20 + required: true + type: number + +outputs: + version: ${{ steps.node.outputs.version }}} + +runs: + using: 'composite' + steps: + - name: Check if Node Version change is required + id: node + runs: bash + env: + npm_config_engine_strict: true + run: + # check if the installed node version works with the engines field in package.json + if npm ln --dry-run --ignore-scripts &>/dev/null; then + NODE_VERSION=$(node -v)" + + # check if .npmrc specifies a node version + elif [ -f .npmrc ] && grep -qP '^node-version\s*=' .npmrc ; then + NODE_VERSION="$(grep -oP '^node-version\s*=\s*\K.*' .npmrc | cut -d '.' -f 1-3)" + + # check if .nvmrc or .node-version specify a node version + elif [ -f .node-version ] && grep -qP '^\d+\.\d+\.\d+$' .node-version ; then + NODE_VERSION="$(cat .node-version)" + elif [ -f .nvmrc ] && grep -qP '^\d+\.\d+\.\d+$' .nvmrc ; then + NODE_VERSION="$(cat .nvmrc)" + + # get the latest version of node that is compatible with the engines field in package.json + elif [ -f package.json ] && jq --exit-status -r '.engines.node' package.json 2>&1 >/dev/null; then + NODE_VERSION="$(bash ./scripts/latest_valid_node_version.sh)" + fi + + # check that we now have a node version, if not, use the default + if grep -qoP '^v?\d+\.(x|\d+\.)?(\d+|x)?' <<<"${NODE_VERSION}"; then + NODE_VERSION="${{ inputs.version }}" + echo "::warning::Unable to determine Node.js version from project files, using default version ${NODE_VERSION}" + fi + + echo "version=${NODE_VERSION}" | tee -a "$GITHUB_OUTPUT" + echo "version=${NODE_VERSION}" >> "$GITHUB_ENV" + + - uses: actions/setup-node@v4 + with: + node-version: "${{ steps.node.outputs.version || '20.x' }}" + cache: npm + + + diff --git a/.github/workflows/push_code_linting.yml b/.github/workflows/push_code_linting.yml index 0e4cc0a1..77d3de5f 100644 --- a/.github/workflows/push_code_linting.yml +++ b/.github/workflows/push_code_linting.yml @@ -1,5 +1,13 @@ name: Code Linting Annotation -on: [pull_request] +on: + pull_request_target: + push: + branches: + - main + - next + - beta + - "*.x" + concurrency: group: ci-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true @@ -21,15 +29,10 @@ jobs: steps: - uses: actions/checkout@v4.1.1 - - id: get-node-version - run: | - NODE_VERSION=$(grep -oP '^node-version\s*=\s*\K.*' .npmrc | cut -d '.' -f 1-3) - echo "node-version=${NODE_VERSION}" >> "$GITHUB_OUTPUT" - - - uses: actions/setup-node@v4 - with: - node-version: ${{ steps.get-node-version.outputs.node-version }} - cache: "npm" + - name: Install compatible Nodejs version + id: install-node + uses: ./.github/actions/install-node + - name: Install Deps run: npm install - uses: xt0rted/markdownlint-problem-matcher@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 260e7775..ec94827a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,11 +2,6 @@ name: Tag and Release Updated NPM Package on: pull_request_target: - branches: - - main - - next - - beta - - "*.x" push: branches: - main @@ -36,14 +31,11 @@ jobs: steps: - uses: actions/checkout@v4.1.1 with: - ref: ${{github.head_ref || github.ref}} + ref: ${{ github.head_ref || github.ref }} - - uses: actions/setup-node@v4 - with: - node-version: "20.x" - registry-url: "https://registry.npmjs.org" - always-auth: true - cache: npm + - name: Install compatible Nodejs version + id: install-node + uses: ./.github/actions/install-node - name: Configure PATH run: | @@ -53,8 +45,8 @@ jobs: - name: Configure Git run: | - git config --global user.email "${{github.event.pusher.email || 'stack@bitflight.io'}}" - git config --global user.name "${{github.event.pusher.name || 'GitHub[bot]'}}" + git config --global user.email "${{ github.event.pusher.email || 'stack@bitflight.io' }}" + git config --global user.name "${{ github.event.pusher.name || 'GitHub[bot]' }}" git fetch --tags git status --porcelain -u @@ -62,10 +54,11 @@ jobs: - run: npm run test -- --coverage-enabled=true - name: 'Report Coverage' if: always() + continue-on-error: true uses: davelosert/vitest-coverage-report-action@v2 with: - json-summary-path: './out/coverage-summary.json' - json-final-path: ./out/coverage-final.json + json-summary-path: './coverage/coverage-summary.json' + json-final-path: ./coverage/coverage-final.json - run: npm run build - run: npm run generate-docs call-workflow-passing-data: diff --git a/.ncurc.yml b/.ncurc.yml index 641c569b..7e1dbeac 100644 --- a/.ncurc.yml +++ b/.ncurc.yml @@ -1,2 +1 @@ upgrade: true -reject: ["chalk"] diff --git a/.npmrc b/.npmrc index 85476da0..b52c2d4b 100644 --- a/.npmrc +++ b/.npmrc @@ -6,6 +6,4 @@ bitflight-devops:registry=https://registry.npmjs.org/ # always-auth=true merge-git-branch-lockfiles-branch-pattern[]=main merge-git-branch-lockfiles-branch-pattern[]=release* -use-node-version=20.7.0 -node-version=20.7.0 progress=false diff --git a/package-lock.json b/package-lock.json index e4848ea0..31bc3b71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,7 +86,7 @@ "vitest": "^0.34.6" }, "engines": { - "node": ">= 18" + "node": ">=21.5.0 <22.0.0" } }, "node_modules/@aashutoshrathi/word-wrap": { diff --git a/package.json b/package.json index 7be8d5de..4e804f06 100644 --- a/package.json +++ b/package.json @@ -209,7 +209,8 @@ "vitest": "^0.34.6" }, "engines": { - "node": ">= 18" + "node": ">=20.0.0 <21.0.0", + "npm": ">=10.0.0" }, "os": [ "!win32" diff --git a/scripts/latest_valid_node_version.sh b/scripts/latest_valid_node_version.sh new file mode 100755 index 00000000..f133c520 --- /dev/null +++ b/scripts/latest_valid_node_version.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -e -o pipefail + +# Check if the node version is compatible with the engine +# +ENGINE_RANGE="$(jq -r '.engines.node' package.json)" +npm view node@"${ENGINE_RANGE}" version | sort | tail -1 | awk '{gsub(/'\''/,"", $2);print $2;}' + diff --git a/vitest.config.ts b/vitest.config.ts index 62175fce..3e2627f5 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -13,8 +13,10 @@ export default defineConfig({ moduleDirectories: ['node_modules'], }, coverage: { - reportsDirectory: './out/coverage', + provider: 'v8', + reportsDirectory: './coverage', reporter: ['text', 'json-summary', 'json'], + include: ['src/'], }, }, }); From 07d845cb6b6026946ce4085379a861e723407248 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 12:38:22 -0500 Subject: [PATCH 02/20] ci(linter): update linter in ci --- .github/workflows/push_code_linting.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push_code_linting.yml b/.github/workflows/push_code_linting.yml index 77d3de5f..31a32b4d 100644 --- a/.github/workflows/push_code_linting.yml +++ b/.github/workflows/push_code_linting.yml @@ -1,6 +1,11 @@ name: Code Linting Annotation on: - pull_request_target: + pull_request: + branches: + - main + - next + - beta + - "*.x" push: branches: - main @@ -9,7 +14,7 @@ on: - "*.x" concurrency: - group: ci-${{ github.event.pull_request.number || github.ref }} + group: ci-linting-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: eslint_annotation: From e9d3e5cb5fadeb187edddb7b7000f5ee40963ce2 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 12:42:11 -0500 Subject: [PATCH 03/20] ci(linter): update linter in ci --- .github/actions/setup-node/action.yml | 2 ++ .github/workflows/deploy.yml | 10 ++++------ .github/workflows/push_code_linting.yml | 4 ++-- .github/workflows/release_action.yml.disabled | 9 +++------ .github/workflows/test.yml | 4 ++-- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index b76ed4e4..143abe77 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -15,6 +15,7 @@ runs: using: 'composite' steps: - name: Check if Node Version change is required + working-directory: ${{ github.workspace }} id: node runs: bash env: @@ -49,6 +50,7 @@ runs: echo "version=${NODE_VERSION}" >> "$GITHUB_ENV" - uses: actions/setup-node@v4 + working-directory: ${{ github.workspace }} with: node-version: "${{ steps.node.outputs.version || '20.x' }}" cache: npm diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 688b3cbf..0d448e7e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -59,12 +59,10 @@ jobs: ref: ${{ inputs.sha }} token: ${{ secrets.RELEASE_TOKEN }} - - uses: actions/setup-node@v4 - with: - node-version: "20.x" - registry-url: "https://registry.npmjs.org" - always-auth: true - cache: npm + + - name: Install compatible Nodejs version + id: setup-node + uses: ./.github/actions/setup-node - name: Configure PATH run: | diff --git a/.github/workflows/push_code_linting.yml b/.github/workflows/push_code_linting.yml index 31a32b4d..480529d9 100644 --- a/.github/workflows/push_code_linting.yml +++ b/.github/workflows/push_code_linting.yml @@ -35,8 +35,8 @@ jobs: - uses: actions/checkout@v4.1.1 - name: Install compatible Nodejs version - id: install-node - uses: ./.github/actions/install-node + id: setup-node + uses: ./.github/actions/setup-node - name: Install Deps run: npm install diff --git a/.github/workflows/release_action.yml.disabled b/.github/workflows/release_action.yml.disabled index 5a0141b7..511055c7 100644 --- a/.github/workflows/release_action.yml.disabled +++ b/.github/workflows/release_action.yml.disabled @@ -25,12 +25,9 @@ jobs: ref: ${{ github.ref }} - name: Prepare repository run: git fetch --unshallow --tags - - uses: actions/setup-node@v4 - with: - node-version: '16.x' - registry-url: 'https://registry.npmjs.org' - always-auth: true - cache: npm + - name: Install compatible Nodejs version + id: setup-node + uses: ./.github/actions/setup-node - run: git config --global init.defaultBranch main - name: Get yarn cache directory path id: yarn-cache-dir-path diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec94827a..d0c0244f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,8 +34,8 @@ jobs: ref: ${{ github.head_ref || github.ref }} - name: Install compatible Nodejs version - id: install-node - uses: ./.github/actions/install-node + id: setup-node + uses: ./.github/actions/setup-node - name: Configure PATH run: | From 0c688adf4df22e208741c7b573f359457f31440e Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 12:49:19 -0500 Subject: [PATCH 04/20] ci(setup-node): update setup-node --- .github/actions/setup-node/action.yml | 18 +++++++++--------- .github/workflows/deploy.yml | 2 +- package.json | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 143abe77..8f5c8c4d 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -4,9 +4,9 @@ description: Sets up Node.js environment inputs: version: description: 'The version of Node.js to use' - default: 20 - required: true - type: number + default: '20.x' + required: false + type: string outputs: version: ${{ steps.node.outputs.version }}} @@ -17,13 +17,13 @@ runs: - name: Check if Node Version change is required working-directory: ${{ github.workspace }} id: node - runs: bash + shell: bash env: npm_config_engine_strict: true run: # check if the installed node version works with the engines field in package.json if npm ln --dry-run --ignore-scripts &>/dev/null; then - NODE_VERSION=$(node -v)" + NODE_VERSION="$(node -v)" # check if .npmrc specifies a node version elif [ -f .npmrc ] && grep -qP '^node-version\s*=' .npmrc ; then @@ -41,18 +41,18 @@ runs: fi # check that we now have a node version, if not, use the default - if grep -qoP '^v?\d+\.(x|\d+\.)?(\d+|x)?' <<<"${NODE_VERSION}"; then - NODE_VERSION="${{ inputs.version }}" + if ! grep -qoP '^v?\d+\.(x|\d+\.)?(\d+|x)?' <<<"${NODE_VERSION}"; then + NODE_VERSION="${{ inputs.version || '20.x' }}" echo "::warning::Unable to determine Node.js version from project files, using default version ${NODE_VERSION}" fi echo "version=${NODE_VERSION}" | tee -a "$GITHUB_OUTPUT" - echo "version=${NODE_VERSION}" >> "$GITHUB_ENV" + echo "NODE_VERSION=${NODE_VERSION}" >> "$GITHUB_ENV" - uses: actions/setup-node@v4 working-directory: ${{ github.workspace }} with: - node-version: "${{ steps.node.outputs.version || '20.x' }}" + node-version: "${{ steps.node.outputs.version }}" cache: npm diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0d448e7e..f5acba12 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,4 +1,4 @@ -name: Run Tests and Lint +name: NPM Release Workflow on: workflow_call: diff --git a/package.json b/package.json index 4e804f06..45765eff 100644 --- a/package.json +++ b/package.json @@ -209,7 +209,7 @@ "vitest": "^0.34.6" }, "engines": { - "node": ">=20.0.0 <21.0.0", + "node": ">=23.0.0 <24.0.0", "npm": ">=10.0.0" }, "os": [ From 756d7403af2341addb73599d5107bf916383b697 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 12:51:20 -0500 Subject: [PATCH 05/20] ci(setup-node): update setup-node --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d0c0244f..3760a292 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,7 +27,7 @@ jobs: actions: write contents: write env: - SKIP_PREFLIGHT_CHECK: trues + SKIP_PREFLIGHT_CHECK: true steps: - uses: actions/checkout@v4.1.1 with: From 7ada5c8b5bb5002c3986fae50ae698a1c41f16fd Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 12:54:43 -0500 Subject: [PATCH 06/20] ci(setup-node): update setup-node --- .github/actions/setup-node/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 8f5c8c4d..7e52ff15 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -9,7 +9,7 @@ inputs: type: string outputs: - version: ${{ steps.node.outputs.version }}} + version: ${{ steps.node.outputs.version }} runs: using: 'composite' @@ -20,7 +20,7 @@ runs: shell: bash env: npm_config_engine_strict: true - run: + run: | # check if the installed node version works with the engines field in package.json if npm ln --dry-run --ignore-scripts &>/dev/null; then NODE_VERSION="$(node -v)" From 7b1545f9f4933719988b9373dd5b3fb81ff130d2 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 12:56:12 -0500 Subject: [PATCH 07/20] ci(setup-node): update setup-node --- .github/actions/setup-node/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 7e52ff15..8fe44549 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -9,7 +9,9 @@ inputs: type: string outputs: - version: ${{ steps.node.outputs.version }} + version: + description: 'The version of Node.js that was set up' + value: ${{ steps.node.outputs.version }} runs: using: 'composite' From a34159c4830f26d7c16dff8eb6f8baa4eb571e30 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:00:20 -0500 Subject: [PATCH 08/20] ci(setup-node): update setup-node --- .github/actions/setup-node/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml index 8fe44549..2df6766d 100644 --- a/.github/actions/setup-node/action.yml +++ b/.github/actions/setup-node/action.yml @@ -52,7 +52,6 @@ runs: echo "NODE_VERSION=${NODE_VERSION}" >> "$GITHUB_ENV" - uses: actions/setup-node@v4 - working-directory: ${{ github.workspace }} with: node-version: "${{ steps.node.outputs.version }}" cache: npm From 75e9480a793a21c7344a6be1ad350d5327df5424 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:02:42 -0500 Subject: [PATCH 09/20] ci(commented): remove commented out code --- src/inputs.ts | 2 -- src/readme-generator.ts | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/inputs.ts b/src/inputs.ts index 5fdeb8d6..8c27b527 100644 --- a/src/inputs.ts +++ b/src/inputs.ts @@ -18,7 +18,6 @@ import { configFileName, ConfigKeys, README_SECTIONS, ReadmeSection } from './co import { repositoryFinder } from './helpers.js'; import LogTask from './logtask/index.js'; import ReadmeEditor from './readme-editor.js'; -// import workingDirectory from './working-directory.js'; /** * Get the filename from the import.meta.url @@ -301,7 +300,6 @@ export function transformGitHubInputsToArgv( const key = ConfigKeysInputsMap[keyParsed] || keyParsed; // eslint-disable-next-line no-param-reassign obj.key = key; - // TODO: This is a hack to get around the fact that nconf doesn't support just returning the new value like its documentation says. config.set(key, obj.value); log.debug(`New input is ${key} with the value ${obj.value}`); diff --git a/src/readme-generator.ts b/src/readme-generator.ts index a05cfc5f..4eec5258 100644 --- a/src/readme-generator.ts +++ b/src/readme-generator.ts @@ -5,7 +5,7 @@ * If an error occurs during the update of a section, it logs the error message and stops the process. * Finally, it saves the updated README.md file and calls the 'save' function. */ -// TODO: Ask CodeWhisperer to write unit tests. + import * as core from '@actions/core'; import { ReadmeSection } from './constants.js'; From ff2cc62ac0945c43ce5c193aeb7a20001bf44369 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:04:24 -0500 Subject: [PATCH 10/20] ci(engines.node): update engines range for node --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 45765eff..4e804f06 100644 --- a/package.json +++ b/package.json @@ -209,7 +209,7 @@ "vitest": "^0.34.6" }, "engines": { - "node": ">=23.0.0 <24.0.0", + "node": ">=20.0.0 <21.0.0", "npm": ">=10.0.0" }, "os": [ From b9710695bfbbd81652a271914bc5bb527f8b08b9 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:08:08 -0500 Subject: [PATCH 11/20] ci(lint): fix false positive on markdown lint --- .markdownlint.json | 1 - 1 file changed, 1 deletion(-) diff --git a/.markdownlint.json b/.markdownlint.json index 512b42fe..aafa5646 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -95,7 +95,6 @@ "MD043": false, // MD044/proper-names - Proper names should have the correct capitalization "MD044": { - "names": ["JavaScript", "TypeScript", "TSLint", "ESLint"], "code_blocks": false }, // MD045/no-alt-text - Images should have alternate text (alt text) From 37687bfb90a1c9f3743c536adcde2954f16a951f Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:12:42 -0500 Subject: [PATCH 12/20] ci(lint): fix false positive on markdown lint --- .github/workflows/test.yml | 3 ++- vitest.config.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3760a292..b7509a4b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,7 +51,8 @@ jobs: git status --porcelain -u - run: npm install - - run: npm run test -- --coverage-enabled=true + - run: npm run test + - run: npm run coverage - name: 'Report Coverage' if: always() continue-on-error: true diff --git a/vitest.config.ts b/vitest.config.ts index 3e2627f5..9b6e65f0 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -14,7 +14,7 @@ export default defineConfig({ }, coverage: { provider: 'v8', - reportsDirectory: './coverage', + reportsDirectory: './out', reporter: ['text', 'json-summary', 'json'], include: ['src/'], }, From adc14fd4bd16e4ad750b2aa5c9c1190176882710 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:18:01 -0500 Subject: [PATCH 13/20] ci(lint): debug coverage --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b7509a4b..9ee314e0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -58,8 +58,8 @@ jobs: continue-on-error: true uses: davelosert/vitest-coverage-report-action@v2 with: - json-summary-path: './coverage/coverage-summary.json' - json-final-path: ./coverage/coverage-final.json + json-summary-path: './out/coverage-summary.json' + json-final-path: ./out/coverage-final.json - run: npm run build - run: npm run generate-docs call-workflow-passing-data: From 44e6aa084e1552cf1365b2df9d0b27901a0caf23 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:26:24 -0500 Subject: [PATCH 14/20] ci(tests): debug permissions --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9ee314e0..e92f42bf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,6 +70,7 @@ jobs: pull-requests: write statuses: write checks: write + contents: write actions: write uses: ./.github/workflows/deploy.yml with: From 9f58e14b50015313c38c7d8b8a536fa4c436e0ec Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:31:57 -0500 Subject: [PATCH 15/20] ci(tests): debug permissions --- .github/workflows/deploy.yml | 12 +++++------- .github/workflows/test.yml | 17 +++++++++-------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f5acba12..ac25cfc5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,19 +34,17 @@ concurrency: cancel-in-progress: true permissions: - contents: read # for checkout + actions: write + contents: write # to be able to publish a GitHub release + issues: write # to be able to comment on released issues + pull-requests: write # to be able to comment on released pull requests + id-token: write # to enable use of OIDC for npm provenance jobs: deploy: name: Deploy NPM build runs-on: ubuntu-latest - permissions: - actions: write - contents: write # to be able to publish a GitHub release - issues: write # to be able to comment on released issues - pull-requests: write # to be able to comment on released pull requests - id-token: write # to enable use of OIDC for npm provenance env: NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e92f42bf..297ebea9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,18 +14,18 @@ on: concurrency: group: ci-${{ github.event.pull_request.number }}${{ github.ref }}${{ github.workflow }} cancel-in-progress: true - +permissions: + issues: write + pull-requests: write + statuses: write + checks: write + contents: write + actions: write + id-token: write jobs: run-tests: name: Run unit tests runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - statuses: write - checks: write - actions: write - contents: write env: SKIP_PREFLIGHT_CHECK: true steps: @@ -72,6 +72,7 @@ jobs: checks: write contents: write actions: write + id-token: write uses: ./.github/workflows/deploy.yml with: ref: ${{ github.head_ref || github.ref }} From 1bcbf5bfda2b9e0651046b6406ba7fa31764fe7e Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:37:00 -0500 Subject: [PATCH 16/20] ci(tests): debug permissions --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 297ebea9..b833d3c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ on: concurrency: group: ci-${{ github.event.pull_request.number }}${{ github.ref }}${{ github.workflow }} cancel-in-progress: true + permissions: issues: write pull-requests: write @@ -22,6 +23,7 @@ permissions: contents: write actions: write id-token: write + jobs: run-tests: name: Run unit tests From 00990d37c19fb3dea8c4ca1f28db6bd17224605d Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 13:45:59 -0500 Subject: [PATCH 17/20] ci(tests): debug permissions --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b833d3c2..adaa2a8e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,9 +20,9 @@ permissions: pull-requests: write statuses: write checks: write - contents: write actions: write id-token: write + contents: write jobs: run-tests: @@ -72,9 +72,9 @@ jobs: pull-requests: write statuses: write checks: write - contents: write actions: write id-token: write + contents: write uses: ./.github/workflows/deploy.yml with: ref: ${{ github.head_ref || github.ref }} From eec9bb63d06d0b854abb8027b9bf5f859b695cb7 Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 14:03:56 -0500 Subject: [PATCH 18/20] ci(tests): debug permissions --- .node-version | 1 + README.md | 3 +++ package.json | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .node-version diff --git a/.node-version b/.node-version new file mode 100644 index 00000000..922f10a1 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +20.x diff --git a/README.md b/README.md index 4455cac4..7b98a606 100644 --- a/README.md +++ b/README.md @@ -221,5 +221,8 @@ You can modify the script below to include any extra variables you like or use n | readme_after | The content of the readme file after the changes were made | + +**NOTE**: [volta.sh](https://volta.sh/) is a great tool for managing node versions, and is configured in this directory. If you have volta installed, you can run `volta install` to install the correct version of node for this project. + diff --git a/package.json b/package.json index 4e804f06..8cfdbd47 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "postinstall": "echo '✨ Successfully Installed'", "prelint": "npm run format && tsc --project tsconfig.json --noemit", "lint": "npm run lint:eslint && npm run lint:markdown", - "lint:fix": "npm run lint:eslint:fix && npm run lint:markdown:fix", + "lint:fix": "npm run lint:eslint:fix && npm run lint:markdown:fix", "lint:eslint": "eslint -c .eslintrc.cjs --color ./src/ ./__tests__/", "lint:eslint:fix": "npm run eslint -- --fix", "markdownlint": "markdownlint", @@ -218,5 +218,8 @@ "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" + }, + "volta": { + "node": "20.9.0" } } From ba990d955ba23256701055325dbc96d08b00fe1d Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 14:12:27 -0500 Subject: [PATCH 19/20] ci(tests): fixup package.json --- package.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8cfdbd47..f7bc5fa1 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/bitflight-devops/github-action-readme-generator" + "url": "git+https://github.com/bitflight-devops/github-action-readme-generator.git" }, "license": "APACHE", "author": "Jamie Nelson ", @@ -30,13 +30,15 @@ "main": "dist/cjs/index.js", "module": "dist/mjs/index.js", "types": "dist/types/index.d.ts", - "bin": "dist/bin/index.js", + "bin": { + "github-action-readme-generator": "dist/bin/index.js" + }, "files": [ "package.json", "README.md", "LICENSE", "CHANGELOG.md", - "/dist" + "dist/" ], "scripts": { "all": "npm run build && npm run format && npm run lint && npm run test", @@ -93,8 +95,8 @@ }, "lint-staged": { "*.{md,json,yaml,yml,sh}": "prettier --write", - "{src,__tests__}/**/*.js": "eslint --cache --fix", - "*.{ts,mts,yml}": [ + "{src,__tests__}/**/*.ts": "eslint --cache --fix", + "*.{yaml,yml}": [ "eslint --cache --fix" ] }, From 02c2d86834dd4aa1278fb24a4c4554a6fc1f218b Mon Sep 17 00:00:00 2001 From: jamie-bitflight Date: Mon, 20 Nov 2023 14:19:26 -0500 Subject: [PATCH 20/20] ci(tests): remove unneeded step --- .github/workflows/test.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index adaa2a8e..e77640e9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,13 +45,6 @@ jobs: echo "$HOME/.local/bin" >> "${GITHUB_PATH}" echo "HOME=$HOME" >> "${GITHUB_ENV}" - - name: Configure Git - run: | - git config --global user.email "${{ github.event.pusher.email || 'stack@bitflight.io' }}" - git config --global user.name "${{ github.event.pusher.name || 'GitHub[bot]' }}" - git fetch --tags - git status --porcelain -u - - run: npm install - run: npm run test - run: npm run coverage