Skip to content

Commit

Permalink
Support release note local preview (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
LitoMore authored Jan 13, 2024
1 parent ed06529 commit 08330c8
Show file tree
Hide file tree
Showing 9 changed files with 587 additions and 545 deletions.
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_REPOSITORY_TOKEN='your-repo-token' npm run preview
```
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

0 comments on commit 08330c8

Please sign in to comment.