Compare commits

..
1 Commits
Author SHA1 Message Date
github-actions[bot] 62a9eee638 v1.4.2 2023-05-06 09:21:28 +00:00
5 changed files with 22 additions and 29 deletions
-6
View File
@@ -1,11 +1,5 @@
# @changesets/action
## 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
+3 -3
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@changesets/action",
"version": "1.4.3",
"version": "1.4.2",
"main": "dist/index.js",
"license": "MIT",
"devDependencies": {
+11 -11
View File
@@ -16,18 +16,18 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
const inputCwd = core.getInput("cwd");
if (inputCwd) {
core.info("changing directory to the one given as the input");
console.log("changing directory to the one given as the input");
process.chdir(inputCwd);
}
let setupGitUser = core.getBooleanInput("setupGitUser");
if (setupGitUser) {
core.info("setting git user");
console.log("setting git user");
await gitUtils.setupUser();
}
core.info("setting GitHub credentials");
console.log("setting GitHub credentials");
await fs.writeFile(
`${process.env.HOME}/.netrc`,
`machine github.com\nlogin github-actions[bot]\npassword ${githubToken}`
@@ -48,27 +48,27 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
switch (true) {
case !hasChangesets && !hasPublishScript:
core.info("No changesets found");
console.log("No changesets found");
return;
case !hasChangesets && hasPublishScript: {
core.info(
console.log(
"No changesets found, attempting to publish any unpublished packages to npm"
);
let userNpmrcPath = `${process.env.HOME}/.npmrc`;
if (fs.existsSync(userNpmrcPath)) {
core.info("Found existing user .npmrc file");
console.log("Found existing user .npmrc file");
const userNpmrcContent = await fs.readFile(userNpmrcPath, "utf8");
const authLine = userNpmrcContent.split("\n").find((line) => {
// 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);
});
if (authLine) {
core.info(
console.log(
"Found existing auth token for the npm registry in the user .npmrc file"
);
} else {
core.info(
console.log(
"Didn't find existing auth token for the npm registry in the user .npmrc file, creating one"
);
fs.appendFileSync(
@@ -77,7 +77,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
);
}
} else {
core.info("No user .npmrc file found, creating one");
console.log("No user .npmrc file found, creating one");
fs.writeFileSync(
userNpmrcPath,
`//registry.npmjs.org/:_authToken=${process.env.NPM_TOKEN}\n`
@@ -100,7 +100,7 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
return;
}
case hasChangesets && !hasNonEmptyChangesets:
core.info("All changesets are empty; not creating PR");
console.log("All changesets are empty; not creating PR");
return;
case hasChangesets:
const { pullRequestNumber } = await runVersion({
@@ -116,6 +116,6 @@ const getOptionalInput = (name: string) => core.getInput(name) || undefined;
return;
}
})().catch((err) => {
core.error(err);
console.error(err);
core.setFailed(err.message);
});
+7 -8
View File
@@ -1,7 +1,6 @@
import { exec, getExecOutput } from "@actions/exec";
import { GitHub, getOctokitOptions } from "@actions/github/lib/utils";
import * as github from "@actions/github";
import * as core from "@actions/core";
import fs from "fs-extra";
import { getPackages, Package } from "@manypkg/get-packages";
import path from "path";
@@ -87,12 +86,12 @@ export async function runPublish({
getOctokitOptions(githubToken, {
throttle: {
onRateLimit: (retryAfter, options: any, octokit, retryCount) => {
core.warning(
console.log(
`Request quota exhausted for request ${options.method} ${options.url}`
);
if (retryCount <= 2) {
core.info(`Retrying after ${retryAfter} seconds!`);
console.log(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
@@ -102,12 +101,12 @@ export async function runPublish({
octokit,
retryCount
) => {
core.warning(
console.log(
`SecondaryRateLimit detected for request ${options.method} ${options.url}`
);
if (retryCount <= 2) {
core.info(`Retrying after ${retryAfter} seconds!`);
console.log(`Retrying after ${retryAfter} seconds!`);
return true;
}
},
@@ -361,7 +360,7 @@ export async function runVersion({
await gitUtils.push(versionBranch, { force: true });
let searchResult = await searchResultPromise;
core.info(JSON.stringify(searchResult.data, null, 2));
console.log(JSON.stringify(searchResult.data, null, 2));
const changedPackagesInfo = (await changedPackagesInfoPromises)
.filter((x) => x)
@@ -376,7 +375,7 @@ export async function runVersion({
});
if (searchResult.data.items.length === 0) {
core.info("creating pull request");
console.log("creating pull request");
const { data: newPullRequest } = await octokit.rest.pulls.create({
base: branch,
head: versionBranch,
@@ -391,7 +390,7 @@ export async function runVersion({
} else {
const [pullRequest] = searchResult.data.items;
core.info(`updating found pull request #${pullRequest.number}`);
console.log(`updating found pull request #${pullRequest.number}`);
await octokit.rest.pulls.update({
pull_number: pullRequest.number,
title: finalPrTitle,