Skip to content

Commit

Permalink
Merge pull request #172 from mscharley/gh-171
Browse files Browse the repository at this point in the history
Make ignored packages actually get excluded
  • Loading branch information
mscharley authored Jun 11, 2024
2 parents e36b580 + e1afc67 commit 14ae68f
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.14.0
2 changes: 1 addition & 1 deletion .vscode/settings.default.json
Original file line number Diff line number Diff line change
@@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions src/__tests__/generateChangeset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Changeset>({
affectedPackages: ['@mscharley/test2'],
message: 'fix: hello, world',
updateType: 'patch',
});
});

it('will exclude the changeset if only ignored packages are included', () => {
expect(
generateChangeset(
pr({}),
Expand Down
4 changes: 3 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -29,7 +30,8 @@ export async function run(): Promise<void> {

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(
Expand Down

0 comments on commit 14ae68f

Please sign in to comment.