diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index 8fe8e9b..120baad 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -38,7 +38,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: - node-version-file: .nvmrc + node-version-file: .tool-versions cache: npm - name: Install Dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e45614..8f83cf3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: id: setup-node uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: - node-version-file: .nvmrc + node-version-file: .tool-versions cache: npm - name: Install Dependencies diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index 12ef47c..5a6381e 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -33,7 +33,7 @@ jobs: id: setup-node uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 with: - node-version-file: .nvmrc + node-version-file: .tool-versions cache: npm - name: Install Dependencies diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 48b14e6..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -20.14.0 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..02fda06 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 20.14.0 diff --git a/.vscode/settings.default.json b/.vscode/settings.default.json index 424c4b4..14dd9b4 100644 --- a/.vscode/settings.default.json +++ b/.vscode/settings.default.json @@ -1,5 +1,5 @@ { - "jest.jestCommandLine": "${NVM_DIR:-~/.nvm}/nvm-exec npx jest", + "jest.jestCommandLine": "${ASDF_DATA_DIR:-~/.asdf}/shims/npx jest", "eslint.options": { "useEslintrc": false, "overrideConfig": { "extends": ["./.github/linters/.eslintrc.yml"] } diff --git a/badges/coverage.svg b/badges/coverage.svg index 3db10bc..c5d8e28 100644 --- a/badges/coverage.svg +++ b/badges/coverage.svg @@ -1 +1 @@ -Coverage: 67.87%Coverage67.87% \ No newline at end of file +Coverage: 67.69%Coverage67.69% \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index f74c7e3..64b1ee8 100644 --- a/dist/index.js +++ b/dist/index.js @@ -31647,6 +31647,7 @@ exports.parseInput = parseInput; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.run = void 0; const core_1 = __nccwpck_require__(2186); +const debugJson_1 = __nccwpck_require__(3562); const getCommitLog_1 = __nccwpck_require__(553); const getEvent_1 = __nccwpck_require__(9362); const getFile_1 = __nccwpck_require__(9103); @@ -31674,7 +31675,8 @@ async function run() { } const getFromGithub = (0, getFile_1.getFile)(octokit, owner, repo, ref); const commits = await (0, getCommitLog_1.getCommitLog)(octokit, owner, repo, pr); - const changesetsConfig = await getFromGithub(ChangesetsConfiguration_1.isChangesetsConfiguration)(`${input.changesetFolder}/config.json`); + const [, changesetsConfig] = await getFromGithub(ChangesetsConfiguration_1.isChangesetsConfiguration)(`${input.changesetFolder}/config.json`); + (0, debugJson_1.debugJson)('Changesets configuration', changesetsConfig); const patchString = await (0, getPrPatch_1.getPrPatch)(octokit, owner, repo, pr.number); const changeset = await (0, processPullRequest_1.processPullRequest)(input, owner, repo, pr, patchString, changesetsConfig, commits, getFromGithub); if (changeset == null) { diff --git a/src/__tests__/generateChangeset.test.ts b/src/__tests__/generateChangeset.test.ts index 0b8c3a3..d414c52 100644 --- a/src/__tests__/generateChangeset.test.ts +++ b/src/__tests__/generateChangeset.test.ts @@ -82,6 +82,23 @@ describe('generateChangeset', () => { }); it('will exclude a package if it is listed as an ignored package for changesets', () => { + expect( + generateChangeset( + pr({}), + commit({ commit: { message: 'fix: hello, world' } }), + input({ useConventionalCommits: true }), + changesets({ ignore: ['@mscharley/test'] }), + { foundChangeset: false }, + [['package.json', { name: '@mscharley/test' }], ['package.json', { name: '@mscharley/test2' }]], + ), + ).toMatchObject({ + affectedPackages: ['@mscharley/test2'], + message: 'fix: hello, world', + updateType: 'patch', + }); + }); + + it('will exclude the changeset if only ignored packages are included', () => { expect( generateChangeset( pr({}), diff --git a/src/main.ts b/src/main.ts index 99ed7b1..2debca9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ import { debug, setOutput } from '@actions/core'; +import { debugJson } from './io/debugJson'; import { getCommitLog } from './io/github/getCommitLog'; import { getEvent } from './io/getEvent'; import { getFile } from './io/github/getFile'; @@ -29,7 +30,8 @@ export async function run(): Promise { const getFromGithub = getFile(octokit, owner, repo, ref); const commits = await getCommitLog(octokit, owner, repo, pr); - const changesetsConfig = await getFromGithub(isChangesetsConfiguration)(`${input.changesetFolder}/config.json`); + const [, changesetsConfig] = await getFromGithub(isChangesetsConfiguration)(`${input.changesetFolder}/config.json`); + debugJson('Changesets configuration', changesetsConfig); const patchString = await getPrPatch(octokit, owner, repo, pr.number); const changeset = await processPullRequest(