Compare commits

..
10 Commits
Author SHA1 Message Date
github-actions[bot] 06245a4e0a v1.4.10 2025-03-10 10:53:45 +00:00
github-actions[bot] ff7179cf12 Version Packages (#449)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-03-10 11:53:19 +01:00
Bjorn Lu 8b16070fe3 Use full git email for github-actions bot (#448)
* Use full git email for github-actions bot

* Create fluffy-clocks-knock.md
2025-03-10 11:42:00 +01:00
Zachary Cowan 07dc948a9f Add Dependabot config file (#432) 2024-12-14 14:40:37 +01:00
github-actions[bot]andgithub-actions[bot] 31ff97e8ac Version Packages (#416)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-10-14 19:12:43 +02:00
Ben McCann 57ab80c611 Improve error message when attempting to publish without publish script defined (#415)
* Improve error message when attempting to publish without publish script defined

* Update src/index.ts

* Update src/index.ts
2024-10-14 18:44:02 +02:00
github-actions[bot]andgithub-actions[bot] 50750fa876 Version Packages (#394)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-26 19:01:26 +02:00
48ab0d2f2e Switch to pull request list API instead of search (#393)
* Switch to pull request list API instead of search

To reduce the amount of rate-limit that we use,
switch to a cheaper API for determining whether
an existing PR exists for a given branch.

* Ensure PR remains open when updating description

* Update .changeset/clean-bees-count.md

Co-authored-by: willo-icon <161356817+willo-icon@users.noreply.github.com>

---------

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
Co-authored-by: willo-icon <161356817+willo-icon@users.noreply.github.com>
2024-08-26 18:38:29 +02:00
Thomas Beer 89b41e6c69 Fix typos in README.md (#384) 2024-07-30 15:02:29 +02:00
Trivikram Kamat c62ef9792f Use latest versions of checkout and setup-node actions (#359) 2024-03-26 21:11:40 +01:00
11 changed files with 58 additions and 36 deletions
+11
View File
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
+2 -2
View File
@@ -10,10 +10,10 @@ jobs:
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Use Node.js 20 - name: Use Node.js 20
uses: actions/setup-node@v1 uses: actions/setup-node@v4
with: with:
node-version: 20.x node-version: 20.x
+2 -2
View File
@@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Use Node.js 20 - name: Use Node.js 20
uses: actions/setup-node@v1 uses: actions/setup-node@v4
with: with:
node-version: 20.x node-version: 20.x
+20
View File
@@ -1,5 +1,25 @@
# @changesets/action # @changesets/action
## 1.4.10
### Patch Changes
- [#448](https://github.com/changesets/action/pull/448) [`8b16070`](https://github.com/changesets/action/commit/8b16070fe386eed3456c83eeed9460160432cf26) Thanks [@bluwy](https://github.com/bluwy)! - Use full git email (`41898282+github-actions[bot]@users.noreply.github.com`) for github-actions bot when making commits
## 1.4.9
### Patch Changes
- [#415](https://github.com/changesets/action/pull/415) [`57ab80c`](https://github.com/changesets/action/commit/57ab80c61104c270bebc125910ae32da3a5aca46) Thanks [@benmccann](https://github.com/benmccann)! - Improve error message when attempting to publish without publish script defined
## 1.4.8
### Patch Changes
- [#393](https://github.com/changesets/action/pull/393) [`48ab0d2`](https://github.com/changesets/action/commit/48ab0d2f2e77ae169182d022591ef5c18c931ff2) Thanks [@s0](https://github.com/s0)! - Ensure the PR remains open when updated
- [#393](https://github.com/changesets/action/pull/393) [`48ab0d2`](https://github.com/changesets/action/commit/48ab0d2f2e77ae169182d022591ef5c18c931ff2) Thanks [@s0](https://github.com/s0)! - Switch to cheaper API for querying existing PRs
## 1.4.7 ## 1.4.7
### Patch Changes ### Patch Changes
+2 -2
View File
@@ -16,7 +16,7 @@ This action for [Changesets](https://github.com/atlassian/changesets) creates a
### Outputs ### Outputs
- published - A boolean value to indicate whether a publishing is happened or not - published - A boolean value to indicate whether a publishing has happened or not
- publishedPackages - A JSON array to present the published packages. The format is `[{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}]` - publishedPackages - A JSON array to present the published packages. The format is `[{"name": "@xx/xx", "version": "1.2.0"}, {"name": "@xx/xy", "version": "0.8.9"}]`
### Example workflow: ### Example workflow:
@@ -124,7 +124,7 @@ For example, you can add a step before running the Changesets GitHub Action:
#### Custom Publishing #### Custom Publishing
If you want to hook into when publishing should occur but have your own publishing functionality you can utilize the `hasChangesets` output. If you want to hook into when publishing should occur but have your own publishing functionality, you can utilize the `hasChangesets` output.
Note that you might need to account for things already being published in your script because a commit without any new changesets can always land on your base branch after a successful publish. In such a case you need to figure out on your own how to skip over the actual publishing logic or handle errors gracefully as most package registries won't allow you to publish over already published version. Note that you might need to account for things already being published in your script because a commit without any new changesets can always land on your base branch after a successful publish. In such a case you need to figure out on your own how to skip over the actual publishing logic or handle errors gracefully as most package registries won't allow you to publish over already published version.
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@changesets/action", "name": "@changesets/action",
"version": "1.4.7", "version": "1.4.10",
"main": "dist/index.js", "main": "dist/index.js",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
+1 -1
View File
@@ -9,7 +9,7 @@ export const setupUser = async () => {
await exec("git", [ await exec("git", [
"config", "config",
"user.email", "user.email",
`"github-actions[bot]@users.noreply.github.com"`, `"41898282+github-actions[bot]@users.noreply.github.com"`,
]); ]);
}; };
+2 -2
View File
@@ -48,11 +48,11 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
switch (true) { switch (true) {
case !hasChangesets && !hasPublishScript: case !hasChangesets && !hasPublishScript:
core.info("No changesets found"); core.info("No changesets present or were removed by merging release PR. Not publishing because no publish script found.");
return; return;
case !hasChangesets && hasPublishScript: { case !hasChangesets && hasPublishScript: {
core.info( core.info(
"No changesets found, attempting to publish any unpublished packages to npm" "No changesets found. Attempting to publish any unpublished packages to npm"
); );
let userNpmrcPath = `${process.env.HOME}/.npmrc`; let userNpmrcPath = `${process.env.HOME}/.npmrc`;
+6 -18
View File
@@ -33,11 +33,9 @@ jest.mock("@actions/github/lib/utils", () => ({
jest.mock("./gitUtils"); jest.mock("./gitUtils");
let mockedGithubMethods = { let mockedGithubMethods = {
search: {
issuesAndPullRequests: jest.fn(),
},
pulls: { pulls: {
create: jest.fn(), create: jest.fn(),
list: jest.fn(),
}, },
repos: { repos: {
createRelease: jest.fn(), createRelease: jest.fn(),
@@ -65,9 +63,7 @@ describe("version", () => {
let cwd = f.copy("simple-project"); let cwd = f.copy("simple-project");
linkNodeModules(cwd); linkNodeModules(cwd);
mockedGithubMethods.search.issuesAndPullRequests.mockImplementationOnce( mockedGithubMethods.pulls.list.mockImplementationOnce(() => ({ data: [] }));
() => ({ data: { items: [] } })
);
mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({ mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({
data: { number: 123 }, data: { number: 123 },
@@ -104,9 +100,7 @@ describe("version", () => {
let cwd = f.copy("simple-project"); let cwd = f.copy("simple-project");
linkNodeModules(cwd); linkNodeModules(cwd);
mockedGithubMethods.search.issuesAndPullRequests.mockImplementationOnce( mockedGithubMethods.pulls.list.mockImplementationOnce(() => ({ data: [] }));
() => ({ data: { items: [] } })
);
mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({ mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({
data: { number: 123 }, data: { number: 123 },
@@ -139,9 +133,7 @@ describe("version", () => {
let cwd = f.copy("ignored-package"); let cwd = f.copy("ignored-package");
linkNodeModules(cwd); linkNodeModules(cwd);
mockedGithubMethods.search.issuesAndPullRequests.mockImplementationOnce( mockedGithubMethods.pulls.list.mockImplementationOnce(() => ({ data: [] }));
() => ({ data: { items: [] } })
);
mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({ mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({
data: { number: 123 }, data: { number: 123 },
@@ -174,9 +166,7 @@ describe("version", () => {
let cwd = f.copy("simple-project"); let cwd = f.copy("simple-project");
linkNodeModules(cwd); linkNodeModules(cwd);
mockedGithubMethods.search.issuesAndPullRequests.mockImplementationOnce( mockedGithubMethods.pulls.list.mockImplementationOnce(() => ({ data: [] }));
() => ({ data: { items: [] } })
);
mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({ mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({
data: { number: 123 }, data: { number: 123 },
@@ -233,9 +223,7 @@ fluminis divesque vulnere aquis parce lapsis rabie si visa fulmineis.
let cwd = f.copy("simple-project"); let cwd = f.copy("simple-project");
linkNodeModules(cwd); linkNodeModules(cwd);
mockedGithubMethods.search.issuesAndPullRequests.mockImplementationOnce( mockedGithubMethods.pulls.list.mockImplementationOnce(() => ({ data: [] }));
() => ({ data: { items: [] } })
);
mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({ mockedGithubMethods.pulls.create.mockImplementationOnce(() => ({
data: { number: 123 }, data: { number: 123 },
+10 -7
View File
@@ -342,9 +342,11 @@ export async function runVersion({
}); });
} }
let searchQuery = `repo:${repo}+state:open+head:${versionBranch}+base:${branch}+is:pull-request`; const existingPullRequestsPromise = octokit.rest.pulls.list({
let searchResultPromise = octokit.rest.search.issuesAndPullRequests({ ...github.context.repo,
q: searchQuery, state: "open",
head: `${github.context.repo.owner}:${versionBranch}`,
base: branch,
}); });
let changedPackages = await getChangedPackages(cwd, versionsByDirectory); let changedPackages = await getChangedPackages(cwd, versionsByDirectory);
let changedPackagesInfoPromises = Promise.all( let changedPackagesInfoPromises = Promise.all(
@@ -376,8 +378,8 @@ export async function runVersion({
await gitUtils.push(versionBranch, { force: true }); await gitUtils.push(versionBranch, { force: true });
let searchResult = await searchResultPromise; let existingPullRequests = await existingPullRequestsPromise;
core.info(JSON.stringify(searchResult.data, null, 2)); core.info(JSON.stringify(existingPullRequests.data, null, 2));
const changedPackagesInfo = (await changedPackagesInfoPromises) const changedPackagesInfo = (await changedPackagesInfoPromises)
.filter((x) => x) .filter((x) => x)
@@ -391,7 +393,7 @@ export async function runVersion({
prBodyMaxCharacters, prBodyMaxCharacters,
}); });
if (searchResult.data.items.length === 0) { if (existingPullRequests.data.length === 0) {
core.info("creating pull request"); core.info("creating pull request");
const { data: newPullRequest } = await octokit.rest.pulls.create({ const { data: newPullRequest } = await octokit.rest.pulls.create({
base: branch, base: branch,
@@ -405,7 +407,7 @@ export async function runVersion({
pullRequestNumber: newPullRequest.number, pullRequestNumber: newPullRequest.number,
}; };
} else { } else {
const [pullRequest] = searchResult.data.items; const [pullRequest] = existingPullRequests.data;
core.info(`updating found pull request #${pullRequest.number}`); core.info(`updating found pull request #${pullRequest.number}`);
await octokit.rest.pulls.update({ await octokit.rest.pulls.update({
@@ -413,6 +415,7 @@ export async function runVersion({
title: finalPrTitle, title: finalPrTitle,
body: prBody, body: prBody,
...github.context.repo, ...github.context.repo,
state: "open",
}); });
return { return {