Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support release note local preview #78

Merged
merged 4 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ Simple Icons welcomes contributions and corrections. Before contributing, please

Also consider the following, this Action is tailor-made for [Simple Icons](https://github.com/simple-icons/simple-icons) and changes should always be made with that in mind. If you wish to implement significant changes you are perhaps better off forking this repository.

## Table of contents

* [Guidelines](#guidelines)
* [Building](#building)

## Guidelines

Please note that modifications should follow these coding guidelines:
Expand All @@ -24,6 +19,14 @@ Please note that modifications should follow these coding guidelines:

## Building

We use [@zeit/ncc](https://github.com/zeit/ncc#readme) to create a single `.js` file that contains all the source code needed to run the Action. This means that this file works without the `node_modules/` folder present.
We use [@vercel/ncc](https://github.com/vercel/ncc#readme) to create a single `.js` file that contains all the source code needed to run the Action. This means that this file works without the `node_modules/` folder present.

Therefore, you should make sure the `npm run build` command does not fail due to your changes. Run `npm run build` before making a commit and include the changes in the `./lib` folder in your commit.

## Local Preview

Use this command below to preview the release note:

```shell
SI_SI_REPOSITORY_TOKEN='your-repo-token' npm run preview
LitoMore marked this conversation as resolved.
Show resolved Hide resolved
```
53 changes: 22 additions & 31 deletions __mocks__/@actions/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,20 +575,13 @@ const files = {
const defaultClient = {
rest: {
issues: {
addLabels: jest
.fn()
.mockName('github.issues.addLabels')
.mockImplementation(() => {
return;
}),
addLabels: jest.fn(() => {}).mockName('github.issues.addLabels'),
},
pulls: {
create: jest
.fn()
.mockName('github.pulls.create')
.mockImplementation(() => {
return { data: { number: 42 } };
}),
.mockImplementation(() => ({ data: { number: 42 } })),
list: jest
.fn()
.mockName('github.pulls.list')
Expand Down Expand Up @@ -619,42 +612,40 @@ const defaultClient = {
};

const patchReleaseClient = _.cloneDeep(defaultClient);
patchReleaseClient.rest.pulls.list = jest.fn().mockImplementation(() => {
return { data: [PRs[4]] };
});
patchReleaseClient.rest.pulls.list = jest
.fn()
.mockImplementation(() => ({ data: [PRs[4]] }));

const minorReleaseClient = _.cloneDeep(defaultClient);
minorReleaseClient.rest.pulls.list = jest.fn().mockImplementation(() => {
return { data: [PRs[1]] };
});
minorReleaseClient.rest.pulls.list = jest
.fn()
.mockImplementation(() => ({ data: [PRs[1]] }));

const majorReleaseClient = _.cloneDeep(defaultClient);
majorReleaseClient.rest.pulls.list = jest.fn().mockImplementation(() => {
return { data: [PRs[16]] };
});
majorReleaseClient.rest.pulls.list = jest
.fn()
.mockImplementation(() => ({ data: [PRs[16]] }));

const addAndUpdateReleaseClient = _.cloneDeep(defaultClient);
addAndUpdateReleaseClient.rest.pulls.list = jest.fn().mockImplementation(() => {
return {
addAndUpdateReleaseClient.rest.pulls.list = jest
.fn()
.mockImplementation(() => ({
data: [PRs[1], PRs[2], PRs[14]],
};
});
}));

const addAndRemoveReleaseClient = _.cloneDeep(defaultClient);
addAndRemoveReleaseClient.rest.pulls.list = jest.fn().mockImplementation(() => {
return {
addAndRemoveReleaseClient.rest.pulls.list = jest
.fn()
.mockImplementation(() => ({
data: [PRs[1], PRs[14], PRs[16]],
};
});
}));

const addRemoveAndUpdateReleaseClient = _.cloneDeep(defaultClient);
addRemoveAndUpdateReleaseClient.rest.pulls.list = jest
.fn()
.mockImplementation(() => {
return {
data: [PRs[1], PRs[2], PRs[14], PRs[16]],
};
});
.mockImplementation(() => ({
data: [PRs[1], PRs[2], PRs[14], PRs[16]],
}));

export const context = {
eventName: 'schedule',
Expand Down
6 changes: 3 additions & 3 deletions lib/index.mjs

Large diffs are not rendered by default.

Loading