Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions .changeset/happy-mirrors-deliver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@unloan/changesets-action": minor
---

Make sure to call return after skipping publish
5 changes: 5 additions & 0 deletions .changeset/stale-oranges-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@unloan/changesets-action": patch
---

bump versions
5 changes: 5 additions & 0 deletions .changeset/stupid-llamas-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sync/changesets-action": minor
---

Add possibility to skip publish
5 changes: 5 additions & 0 deletions .changeset/tough-experts-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@unloan/changesets-action": minor
---

fixes
48 changes: 48 additions & 0 deletions .github/ISSUE_TEMPLATE/risk_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: Risk (markdown version)
about: Report a risk you've identified
title: ''
labels: risk
assignees: ''
---

### Description

<!-- A detailed description about the risk and its source -->

#### Impact

<!-- How does it impact the business? -->

### Likelihood

<!-- Guidance: https://handbook.x15.ventures/#/risk_and_compliance/5x5_risk_matrix -->
<!-- Uncomment one of the following: -->
<!--1 - Rare-->
<!--2 - Unlikely-->
<!--3 - Possible-->
<!--4 - Likely-->
<!--5 - Almost certain-->

### Impact

<!-- Guidance: https://handbook.x15.ventures/#/risk_and_compliance/5x5_risk_matrix -->
<!-- Uncomment one of the following: -->
<!--1 - Negligible-->
<!--2 - Minor-->
<!--3 - Moderate-->
<!--4 - Major-->
<!--5 - Severe-->

### Controls and mitigations

<!-- What has been done to 1) mitigate (lower the impact of) the risk, 2) list controls (that lower the likelihood that this risk should occur) 3) should this risk occur what contingencies do you have (i.e what will you do if this risk occurs)? -->

#### Controls (things that prevent this risk from occurring)

- [x] Register the risk
- [ ] _TODO: Additional controls to mitigate the risk_

#### Residual risks

<!-- Add residual risks as required -->
59 changes: 59 additions & 0 deletions .github/ISSUE_TEMPLATE/risk_template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Risk
description: Report a risk you've identified
labels: [risk]
body:
- type: markdown
attributes:
value: |
Raise a risk and we will help you manage it.

- type: textarea
id: description
attributes:
label: Description
description: A detailed description about the risk, its source, and how it impacts the business.
validations:
required: true

- type: dropdown
id: likelihood
attributes:
label: Likelihood
description: For more information, refer to [5 by 5 risk matrix](https://handbook.x15.ventures/#/risk_and_compliance/5x5_risk_matrix)
options:
- 1 - Rare
- 2 - Unlikely
- 3 - Possible
- 4 - Likely
- 5 - Almost certain
validations:
required: true

- type: dropdown
id: impact
attributes:
label: Impact
description: For more information, refer to [5 by 5 risk matrix](https://handbook.x15.ventures/#/risk_and_compliance/5x5_risk_matrix)
options:
- 1 - Negligible
- 2 - Minor
- 3 - Moderate
- 4 - Major
- 5 - Severe
validations:
required: true

- type: textarea
id: controls
attributes:
label: Controls and mitigations
description: What has been done to 1) mitigate (lower the impact of) the risk, 2) list controls (that lower the likelihood that this risk should occur) 3) should this risk occur what contingencies do you have (i.e what will you do if this risk occurs)?
value: |
#### Controls (things that prevent this risk from occurring)

- [x] Register the risk
- [ ] _TODO: Additional controls to mitigate the risk_

#### Residual risks

<!-- Add residual risks as required -->
6 changes: 6 additions & 0 deletions .github/risk-reporting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
project: unloan/changesets-action
# output: risks.yml

# include risk summary in the following files
summary-files:
- README.md
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Use Node.js 14
uses: actions/setup-node@v1
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 14.x
node-version: 20.x

- name: Install Dependencies
run: yarn --frozen-lockfile
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ inputs:
description: "A boolean value to indicate whether to create Github releases after `publish` or not"
required: false
default: true
skipPublish:
description: "A boolean value to indicate whether to skip publish or not"
required: false
default: false
outputs:
published:
description: A boolean value to indicate whether a publishing is happened or not
Expand Down
65 changes: 65 additions & 0 deletions dist/index.js

Large diffs are not rendered by default.

46 changes: 26 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
{
"name": "@changesets/action",
"version": "1.2.2",
"name": "@unloan/changesets-action",
"version": "5.0.2",
"main": "dist/index.js",
"license": "MIT",
"devDependencies": {
"@changesets/changelog-github": "^0.4.2",
"@changesets/cli": "^2.20.0",
"@changesets/write": "^0.1.6",
"@vercel/ncc": "^0.36.1",
"fixturez": "^1.1.0",
"parcel": "^1.12.3",
"prettier": "^2.0.5",
"typescript": "^3.5.3"
"typescript": "^5.0.4",
"@babel/core": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/preset-typescript": "^7.13.0",
"@types/fs-extra": "^8.0.0",
"@types/jest": "^29.5.1",
"@types/node": "^20.11.17",
"@types/semver": "^7.5.0",
"babel-jest": "^29.5.0",
"husky": "^3.0.3",
"jest": "^29.5.0"
},
"scripts": {
"build": "parcel build ./src/index.ts --no-source-maps --target=node --bundle-node-modules",
"build": "ncc build src/index.ts -o dist --transpile-only --minify",
"test": "jest",
"test:watch": "yarn test --watch",
"changeset": "changeset",
"bump": "node ./scripts/bump.js",
"release": "node ./scripts/release.js"
},
"dependencies": {
"@actions/core": "^1.3.0",
"@actions/exec": "^1.1.0",
"@actions/github": "^4.0.0",
"@babel/core": "^7.13.10",
"@babel/preset-env": "^7.13.10",
"@babel/preset-typescript": "^7.13.0",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.1",
"@actions/github": "^5.1.1",
"@changesets/pre": "^1.0.9",
"@changesets/read": "^0.5.3",
"@manypkg/get-packages": "^1.1.3",
"@types/fs-extra": "^8.0.0",
"@types/jest": "^24.0.18",
"@types/node": "^12.7.1",
"@types/semver": "^6.0.2",
"babel-jest": "^24.9.0",
"@octokit/plugin-throttling": "^5.2.1",
"fs-extra": "^8.1.0",
"husky": "^3.0.3",
"jest": "^24.9.0",
"mdast-util-to-string": "^1.0.6",
"remark-parse": "^7.0.1",
"remark-stringify": "^7.0.3",
"resolve-from": "^5.0.0",
"semver": "^6.3.0",
"semver": "^7.5.3",
"unified": "^8.3.2"
},
"husky": {
"hooks": {}
},
"prettier": {}
"prettier": {},
"resolutions": {
"**/@octokit/core": "4.2.0",
"trim": "^0.0.3",
"y18n": "^4.0.1"
}
}
59 changes: 51 additions & 8 deletions src/__snapshots__/run.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`version creates simple PR 1`] = `
Array [
Object {
[
{
"base": "some-branch",
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.


# Releases
## simple-project-pkg-a@1.1.0

Expand All @@ -18,7 +19,7 @@ Array [
- Updated dependencies
- simple-project-pkg-b@1.1.0

## simple-project-pkg-b@1.1.0
## simple-project-pkg-b@1.1.0

### Minor Changes

Expand All @@ -32,12 +33,53 @@ Array [
]
`;

exports[`version does not include any release information if a message with simplified release info exceeds size limit 1`] = `
[
{
"base": "some-branch",
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.


# Releases

> All release information have been omitted from this message, as the content exceeds the size limit.",
"head": "changeset-release/some-branch",
"owner": "changesets",
"repo": "action",
"title": "Version Packages",
},
]
`;

exports[`version does not include changelog entries if full message exceeds size limit 1`] = `
[
{
"base": "some-branch",
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.


# Releases

> The changelog information of each package has been omitted from this message, as the content exceeds the size limit.

## simple-project-pkg-a@1.1.0

",
"head": "changeset-release/some-branch",
"owner": "changesets",
"repo": "action",
"title": "Version Packages",
},
]
`;

exports[`version doesn't include ignored package that got a dependency update in the PR body 1`] = `
Array [
Object {
[
{
"base": "some-branch",
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.


# Releases
## ignored-package-pkg-b@1.1.0

Expand All @@ -54,11 +96,12 @@ Array [
`;

exports[`version only includes bumped packages in the PR body 1`] = `
Array [
Object {
[
{
"base": "some-branch",
"body": "This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to some-branch, this PR will be updated.


# Releases
## simple-project-pkg-a@1.1.0

Expand All @@ -72,4 +115,4 @@ Array [
"title": "Version Packages",
},
]
`;
`;
8 changes: 4 additions & 4 deletions src/__snapshots__/utils.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`it sorts the things right 1`] = `
Array [
Object {
[
{
"highestLevel": 3,
"name": "c",
"private": false,
},
Object {
{
"highestLevel": 1,
"name": "b",
"private": false,
},
Object {
{
"highestLevel": 3,
"name": "a",
"private": true,
Expand Down
8 changes: 8 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
let hasChangesets = changesets.length !== 0;
let hasPublishScript = !!publishScript;

let skipPublish = core.getBooleanInput("skipPublish");

core.setOutput("published", "false");
core.setOutput("publishedPackages", "[]");
core.setOutput("hasChangesets", String(hasChangesets));
Expand All @@ -47,6 +49,12 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
case !hasChangesets && !hasPublishScript:
console.log("No changesets found");
return;
case !hasChangesets && hasPublishScript && skipPublish: {
console.log(
"No changesets found, but skipped publish any unpublished packages to npm as requested"
);
return;
}
case !hasChangesets && hasPublishScript: {
console.log(
"No changesets found, attempting to publish any unpublished packages to npm"
Expand Down
Loading