diff --git a/.github/workflows/push_code_linting.yml b/.github/workflows/push_code_linting.yml index 0e4cc0a..480529d 100644 --- a/.github/workflows/push_code_linting.yml +++ b/.github/workflows/push_code_linting.yml @@ -1,7 +1,20 @@ name: Code Linting Annotation -on: [pull_request] +on: + pull_request: + branches: + - main + - next + - beta + - "*.x" + push: + branches: + - main + - next + - beta + - "*.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: @@ -21,15 +34,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: setup-node + uses: ./.github/actions/setup-node + - name: Install Deps run: npm install - uses: xt0rted/markdownlint-problem-matcher@v2 diff --git a/.github/workflows/release_action.yml.disabled b/.github/workflows/release_action.yml.disabled index 5a0141b..511055c 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 adaa2a8..e77640e 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 diff --git a/.markdownlint.json b/.markdownlint.json index 512b42f..aafa564 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) diff --git a/.ncurc.yml b/.ncurc.yml index 641c569..7e1dbea 100644 --- a/.ncurc.yml +++ b/.ncurc.yml @@ -1,2 +1 @@ upgrade: true -reject: ["chalk"] diff --git a/.node-version b/.node-version new file mode 100644 index 0000000..922f10a --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +20.x diff --git a/.npmrc b/.npmrc index 85476da..b52c2d4 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/README.md b/README.md index 4455cac..7b98a60 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-lock.json b/package-lock.json index a327293..912061a 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 7277633..9665502 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" ] }, @@ -209,7 +211,8 @@ "vitest": "^0.34.6" }, "engines": { - "node": ">= 18" + "node": ">=20.0.0 <21.0.0", + "npm": ">=10.0.0" }, "os": [ "!win32" @@ -217,5 +220,8 @@ "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" + }, + "volta": { + "node": "20.9.0" } } diff --git a/src/inputs.ts b/src/inputs.ts index 5fdeb8d..8c27b52 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 a05cfc5..4eec525 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';