Compare commits

..
Author SHA1 Message Date
github-actions[bot] d89c1de63c v1.4.4 2023-05-10 05:27:50 +00:00
github-actions[bot]andgithub-actions[bot] 28271921f0 Version Packages (#292)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-10 07:26:55 +02:00
Mateusz Burzyński ba5ea93f34 Replace Parcel with ncc 2023-05-09 17:44:11 +02:00
Mateusz Burzyński 4e64830a00 Update Jest 2023-05-09 17:32:35 +02:00
Viktor VarlandandMateusz Burzyński db8a1099bc Wire up @octokit/plugin-throttling with all GitHub Octokit instances (#291)
* fix: use throttling-wired octokit everywhere

* test: fix run.test.ts

* Update .changeset/new-worms-knock.md

---------

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
2023-05-09 17:21:08 +02:00
github-actions[bot]andgithub-actions[bot] 4cb1c2fbde Version Packages (#290)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-09 06:47:54 +02:00
Viktor VarlandandMateusz Burzyński 8b2818674d Use logging provided by @actions/core (#289)
* chore: migrate to logging from @actions/core

* Update src/index.ts

* Update .changeset/blue-hornets-marry.md

---------

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
2023-05-08 23:42:00 +02:00
github-actions[bot]andgithub-actions[bot] ab485bff43 Version Packages (#288)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-06 11:20:22 +02:00
Viktor VarlandandMateusz Burzyński 225a1e8cbc Add a throttling plugin to the used Octokit instance to retry requests after hitting secondary rate limits (#286)
* fix: prevent hitting github secondary rate limits

Adds the octokit plugin for throttling / rate-limiting to fix the
problem where action runs get blocked with a 403 error[1].

The `github.getOctokit`[2] function accepts a list of plugins, so this
passes in the `throttling` plugin[3] to be hooked into the octokit
instance.

It also needs some configuration to setup the `throttle` mechanisms,
passed in to the `getOctokit` function.

[1]: https://github.com/changesets/action/issues/192
[2]: https://github.com/actions/toolkit/blob/main/packages/github/src/github.ts#LL18C40-L18C40
[3]: https://github.com/octokit/plugin-throttling.js

* refactor: change rate limit callback signatures

Based on additional docs, the callbacks seem to have changes to their
signatures[1]. This change aligns this implementation with the docs[2].

[1]: https://octokit.github.io/rest.js/v19#throttling
[2]: https://github.com/octokit/plugin-throttling.js/blob/v5.1.1/src/index.ts#L90-L91

* chore: add changeset

* wire up typed throttle options

* Upgrade TS

* refactor: use console based logging

* Update .changeset/rotten-carrots-pump.md

---------

Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
2023-05-06 10:52:18 +02:00
Mateusz Burzyński 595655c3ea Update more examples with references to the latest versions of core actions 2022-12-05 14:55:10 +01:00
allbetter-max da3a687419 Update examples in the docs to use new versions of other core actions like checkout and setup-node (#237) 2022-12-05 14:53:04 +01:00
11 changed files with 1674 additions and 5860 deletions
-3
View File
@@ -1,3 +0,0 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
+23
View File
@@ -1,5 +1,28 @@
# @changesets/action # @changesets/action
## 1.4.4
### Patch Changes
- [#291](https://github.com/changesets/action/pull/291) [`db8a109`](https://github.com/changesets/action/commit/db8a1099bc0ba1dd6f46a5b9df4212e4f69e78c9) Thanks [@varl](https://github.com/varl)! - Wire up [`@octokit/plugin-throttling`](https://github.com/octokit/plugin-throttling.js) with all GitHub Octokit instances
## 1.4.3
### Patch Changes
- [#289](https://github.com/changesets/action/pull/289) [`8b28186`](https://github.com/changesets/action/commit/8b2818674de86a7fc69aebb9ed6b486ee32eb96e) Thanks [@varl](https://github.com/varl)! - Use logging provided by `@actions/core`
## 1.4.2
### Patch Changes
- [#286](https://github.com/changesets/action/pull/286) [`225a1e8`](https://github.com/changesets/action/commit/225a1e8cbcabb7b585174ba0ad806549db40d4cd) Thanks [@varl](https://github.com/varl)! - This patch implements the [`@octokit/plugin-throttling`](https://github.com/octokit/plugin-throttling.js) plugin and [wires
it up with the internal GitHub Octokit instance](https://github.com/actions/toolkit/tree/457303960f03375db6f033e214b9f90d79c3fe5c/packages/github#extending-the-octokit-instance).
This plugin is recommended by [the Octokit docs](://octokit.github.io/rest.js/v19#throttling) as it implements all the GitHub [best practices for integrators](https://docs.github.com/en/rest/guides/best-practices-for-integrators?apiVersion=2022-11-28).
This should help with `changesets/action` gitting spurious secondary rate limits and failing CI jobs, for which the only known workaround is to simply re-run the job.
## 1.4.1 ## 1.4.1
### Patch Changes ### Patch Changes
+16 -16
View File
@@ -41,12 +41,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup Node.js 12.x - name: Setup Node.js 16
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: 12.x node-version: 16
- name: Install Dependencies - name: Install Dependencies
run: yarn run: yarn
@@ -77,12 +77,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup Node.js 12.x - name: Setup Node.js 16.x
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: 12.x node-version: 16.x
- name: Install Dependencies - name: Install Dependencies
run: yarn run: yarn
@@ -142,12 +142,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup Node.js 12.x - name: Setup Node.js 16.x
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: 12.x node-version: 16.x
- name: Install Dependencies - name: Install Dependencies
run: yarn run: yarn
@@ -186,12 +186,12 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@v2 uses: actions/checkout@v3
- name: Setup Node.js 12.x - name: Setup Node.js 16.x
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: 12.x node-version: 16.x
- name: Install Dependencies - name: Install Dependencies
run: yarn run: yarn
+59
View File
File diff suppressed because one or more lines are too long
+12 -8
View File
@@ -1,19 +1,19 @@
{ {
"name": "@changesets/action", "name": "@changesets/action",
"version": "1.4.1", "version": "1.4.4",
"main": "dist/index.js", "main": "dist/index.js",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@changesets/changelog-github": "^0.4.2", "@changesets/changelog-github": "^0.4.2",
"@changesets/cli": "^2.20.0", "@changesets/cli": "^2.20.0",
"@changesets/write": "^0.1.6", "@changesets/write": "^0.1.6",
"@vercel/ncc": "^0.36.1",
"fixturez": "^1.1.0", "fixturez": "^1.1.0",
"parcel": "^1.12.3",
"prettier": "^2.0.5", "prettier": "^2.0.5",
"typescript": "^3.5.3" "typescript": "^5.0.4"
}, },
"scripts": { "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": "jest",
"test:watch": "yarn test --watch", "test:watch": "yarn test --watch",
"changeset": "changeset", "changeset": "changeset",
@@ -33,14 +33,15 @@
"@changesets/pre": "^1.0.9", "@changesets/pre": "^1.0.9",
"@changesets/read": "^0.5.3", "@changesets/read": "^0.5.3",
"@manypkg/get-packages": "^1.1.3", "@manypkg/get-packages": "^1.1.3",
"@octokit/plugin-throttling": "5.1.1",
"@types/fs-extra": "^8.0.0", "@types/fs-extra": "^8.0.0",
"@types/jest": "^24.0.18", "@types/jest": "^29.5.1",
"@types/node": "^12.7.1", "@types/node": "^12.7.1",
"@types/semver": "^6.0.2", "@types/semver": "^6.0.2",
"babel-jest": "^24.9.0", "babel-jest": "^29.5.0",
"fs-extra": "^8.1.0", "fs-extra": "^8.1.0",
"husky": "^3.0.3", "husky": "^3.0.3",
"jest": "^24.9.0", "jest": "^29.5.0",
"mdast-util-to-string": "^1.0.6", "mdast-util-to-string": "^1.0.6",
"remark-parse": "^7.0.1", "remark-parse": "^7.0.1",
"remark-stringify": "^7.0.3", "remark-stringify": "^7.0.3",
@@ -51,5 +52,8 @@
"husky": { "husky": {
"hooks": {} "hooks": {}
}, },
"prettier": {} "prettier": {},
"resolutions": {
"**/@octokit/core": "4.2.0"
}
} }
+10 -10
View File
@@ -1,8 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`version creates simple PR 1`] = ` exports[`version creates simple PR 1`] = `
Array [ [
Object { {
"base": "some-branch", "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. "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.
@@ -34,8 +34,8 @@ Array [
`; `;
exports[`version does not include any release information if a message with simplified release info exceeds size limit 1`] = ` exports[`version does not include any release information if a message with simplified release info exceeds size limit 1`] = `
Array [ [
Object { {
"base": "some-branch", "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. "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.
@@ -52,8 +52,8 @@ Array [
`; `;
exports[`version does not include changelog entries if full message exceeds size limit 1`] = ` exports[`version does not include changelog entries if full message exceeds size limit 1`] = `
Array [ [
Object { {
"base": "some-branch", "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. "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.
@@ -74,8 +74,8 @@ Array [
`; `;
exports[`version doesn't include ignored package that got a dependency update in the PR body 1`] = ` exports[`version doesn't include ignored package that got a dependency update in the PR body 1`] = `
Array [ [
Object { {
"base": "some-branch", "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. "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.
@@ -96,8 +96,8 @@ Array [
`; `;
exports[`version only includes bumped packages in the PR body 1`] = ` exports[`version only includes bumped packages in the PR body 1`] = `
Array [ [
Object { {
"base": "some-branch", "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. "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.
+4 -4
View File
@@ -1,18 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP // Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`it sorts the things right 1`] = ` exports[`it sorts the things right 1`] = `
Array [ [
Object { {
"highestLevel": 3, "highestLevel": 3,
"name": "c", "name": "c",
"private": false, "private": false,
}, },
Object { {
"highestLevel": 1, "highestLevel": 1,
"name": "b", "name": "b",
"private": false, "private": false,
}, },
Object { {
"highestLevel": 3, "highestLevel": 3,
"name": "a", "name": "a",
"private": true, "private": true,
+11 -11
View File
@@ -16,18 +16,18 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
const inputCwd = core.getInput("cwd"); const inputCwd = core.getInput("cwd");
if (inputCwd) { if (inputCwd) {
console.log("changing directory to the one given as the input"); core.info("changing directory to the one given as the input");
process.chdir(inputCwd); process.chdir(inputCwd);
} }
let setupGitUser = core.getBooleanInput("setupGitUser"); let setupGitUser = core.getBooleanInput("setupGitUser");
if (setupGitUser) { if (setupGitUser) {
console.log("setting git user"); core.info("setting git user");
await gitUtils.setupUser(); await gitUtils.setupUser();
} }
console.log("setting GitHub credentials"); core.info("setting GitHub credentials");
await fs.writeFile( await fs.writeFile(
`${process.env.HOME}/.netrc`, `${process.env.HOME}/.netrc`,
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}` `machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
@@ -48,27 +48,27 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
switch (true) { switch (true) {
case !hasChangesets && !hasPublishScript: case !hasChangesets && !hasPublishScript:
console.log("No changesets found"); core.info("No changesets found");
return; return;
case !hasChangesets && hasPublishScript: { case !hasChangesets && hasPublishScript: {
console.log( 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`;
if (fs.existsSync(userNpmrcPath)) { if (fs.existsSync(userNpmrcPath)) {
console.log("Found existing user .npmrc file"); core.info("Found existing user .npmrc file");
const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8"); const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8");
const authLine = userNpmrcContent.split("\n").find((line) => { const authLine = userNpmrcContent.split("\n").find((line) => {
// check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105 // check based on https://github.com/npm/cli/blob/8f8f71e4dd5ee66b3b17888faad5a7bf6c657eed/test/lib/adduser.js#L103-L105
return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line); return /^\s*\/\/registry\.npmjs\.org\/:[_-]authToken=/i.test(line);
}); });
if (authLine) { if (authLine) {
console.log( core.info(
"Found existing auth token for the npm registry in the user .npmrc file" "Found existing auth token for the npm registry in the user .npmrc file"
); );
} else { } else {
console.log( core.info(
"Didn't find existing auth token for the npm registry in the user .npmrc file, creating one" "Didn't find existing auth token for the npm registry in the user .npmrc file, creating one"
); );
fs.appendFileSync( fs.appendFileSync(
@@ -77,7 +77,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
); );
} }
} else { } else {
console.log("No user .npmrc file found, creating one"); core.info("No user .npmrc file found, creating one");
fs.writeFileSync( fs.writeFileSync(
userNpmrcPath, userNpmrcPath,
`//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n` `//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n`
@@ -100,7 +100,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
return; return;
} }
case hasChangesets && !hasNonEmptyChangesets: case hasChangesets && !hasNonEmptyChangesets:
console.log("All changesets are empty; not creating PR"); core.info("All changesets are empty; not creating PR");
return; return;
case hasChangesets: case hasChangesets:
const { pullRequestNumber } = await runVersion({ const { pullRequestNumber } = await runVersion({
@@ -116,6 +116,6 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
return; return;
} }
})().catch((err) => { })().catch((err) => {
console.error(err); core.error(err);
core.setFailed(err.message); core.setFailed(err.message);
}); });
+14 -4
View File
@@ -1,5 +1,6 @@
import fixturez from "fixturez"; import fixturez from "fixturez";
import * as github from "@actions/github"; import * as github from "@actions/github";
import * as githubUtils from "@actions/github/lib/utils";
import fs from "fs-extra"; import fs from "fs-extra";
import path from "path"; import path from "path";
import writeChangeset from "@changesets/write"; import writeChangeset from "@changesets/write";
@@ -15,7 +16,19 @@ jest.mock("@actions/github", () => ({
ref: "refs/heads/some-branch", ref: "refs/heads/some-branch",
sha: "xeac7", sha: "xeac7",
}, },
getOctokit: jest.fn(), }));
jest.mock("@actions/github/lib/utils", () => ({
GitHub: {
plugin: () => {
// function necessary to be used as constructor
return function() {
return {
rest: mockedGithubMethods,
}
}
},
},
getOctokitOptions: jest.fn(),
})); }));
jest.mock("./gitUtils"); jest.mock("./gitUtils");
@@ -30,9 +43,6 @@ let mockedGithubMethods = {
createRelease: jest.fn(), createRelease: jest.fn(),
}, },
}; };
(github.getOctokit as any).mockImplementation(() => ({
rest: mockedGithubMethods,
}));
let f = fixturez(__dirname); let f = fixturez(__dirname);
+48 -6
View File
@@ -1,5 +1,7 @@
import { exec, getExecOutput } from "@actions/exec"; import { exec, getExecOutput } from "@actions/exec";
import { GitHub, getOctokitOptions } from "@actions/github/lib/utils";
import * as github from "@actions/github"; import * as github from "@actions/github";
import * as core from "@actions/core";
import fs from "fs-extra"; import fs from "fs-extra";
import { getPackages, Package } from "@manypkg/get-packages"; import { getPackages, Package } from "@manypkg/get-packages";
import path from "path"; import path from "path";
@@ -14,6 +16,9 @@ import {
import * as gitUtils from "./gitUtils"; import * as gitUtils from "./gitUtils";
import readChangesetState from "./readChangesetState"; import readChangesetState from "./readChangesetState";
import resolveFrom from "resolve-from"; import resolveFrom from "resolve-from";
import { throttling } from "@octokit/plugin-throttling";
// temporary workaround for https://github.com/octokit/plugin-throttling.js/pull/590
import type {} from "@octokit/plugin-throttling/dist-types/types.d";
// GitHub Issues/PRs messages have a max size limit on the // GitHub Issues/PRs messages have a max size limit on the
// message body payload. // message body payload.
@@ -21,8 +26,42 @@ import resolveFrom from "resolve-from";
// To avoid that, we ensure to cap the message to 60k chars. // To avoid that, we ensure to cap the message to 60k chars.
const MAX_CHARACTERS_PER_MESSAGE = 60000; const MAX_CHARACTERS_PER_MESSAGE = 60000;
const setupOctokit = (githubToken) => {
return new (GitHub.plugin(throttling))(
getOctokitOptions(githubToken, {
throttle: {
onRateLimit: (retryAfter, options: any, octokit, retryCount) => {
core.warning(
`Request quota exhausted for request ${options.method} ${options.url}`
);
if (retryCount <= 2) {
core.info(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
onSecondaryRateLimit: (
retryAfter,
options: any,
octokit,
retryCount
) => {
core.warning(
`SecondaryRateLimit detected for request ${options.method} ${options.url}`
);
if (retryCount <= 2) {
core.info(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
},
})
);
};
const createRelease = async ( const createRelease = async (
octokit: ReturnType<typeof github.getOctokit>, octokit: ReturnType<typeof GitHub>,
{ pkg, tagName }: { pkg: Package; tagName: string } { pkg, tagName }: { pkg: Package; tagName: string }
) => { ) => {
try { try {
@@ -78,7 +117,8 @@ export async function runPublish({
createGithubReleases, createGithubReleases,
cwd = process.cwd(), cwd = process.cwd(),
}: PublishOptions): Promise<PublishResult> { }: PublishOptions): Promise<PublishResult> {
let octokit = github.getOctokit(githubToken); const octokit = setupOctokit(githubToken);
let [publishCommand, ...publishArgs] = script.split(/\s+/); let [publishCommand, ...publishArgs] = script.split(/\s+/);
let changesetPublishOutput = await getExecOutput( let changesetPublishOutput = await getExecOutput(
@@ -266,10 +306,12 @@ export async function runVersion({
hasPublishScript = false, hasPublishScript = false,
prBodyMaxCharacters = MAX_CHARACTERS_PER_MESSAGE, prBodyMaxCharacters = MAX_CHARACTERS_PER_MESSAGE,
}: VersionOptions): Promise<RunVersionResult> { }: VersionOptions): Promise<RunVersionResult> {
const octokit = setupOctokit(githubToken);
let repo = `${github.context.repo.owner}/${github.context.repo.repo}`; let repo = `${github.context.repo.owner}/${github.context.repo.repo}`;
let branch = github.context.ref.replace("refs/heads/", ""); let branch = github.context.ref.replace("refs/heads/", "");
let versionBranch = `changeset-release/${branch}`; let versionBranch = `changeset-release/${branch}`;
let octokit = github.getOctokit(githubToken);
let { preState } = await readChangesetState(cwd); let { preState } = await readChangesetState(cwd);
await gitUtils.switchToMaybeExistingBranch(versionBranch); await gitUtils.switchToMaybeExistingBranch(versionBranch);
@@ -325,7 +367,7 @@ export async function runVersion({
await gitUtils.push(versionBranch, { force: true }); await gitUtils.push(versionBranch, { force: true });
let searchResult = await searchResultPromise; let searchResult = await searchResultPromise;
console.log(JSON.stringify(searchResult.data, null, 2)); core.info(JSON.stringify(searchResult.data, null, 2));
const changedPackagesInfo = (await changedPackagesInfoPromises) const changedPackagesInfo = (await changedPackagesInfoPromises)
.filter((x) => x) .filter((x) => x)
@@ -340,7 +382,7 @@ export async function runVersion({
}); });
if (searchResult.data.items.length === 0) { if (searchResult.data.items.length === 0) {
console.log("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,
head: versionBranch, head: versionBranch,
@@ -355,7 +397,7 @@ export async function runVersion({
} else { } else {
const [pullRequest] = searchResult.data.items; const [pullRequest] = searchResult.data.items;
console.log(`updating found pull request #${pullRequest.number}`); core.info(`updating found pull request #${pullRequest.number}`);
await octokit.rest.pulls.update({ await octokit.rest.pulls.update({
pull_number: pullRequest.number, pull_number: pullRequest.number,
title: finalPrTitle, title: finalPrTitle,
+1477 -5798
View File
File diff suppressed because it is too large Load Diff