mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Add back cwd input (#718)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@changesets/action": minor
|
||||
---
|
||||
|
||||
Add a `cwd` input to the root action, `/select-mode`, `/version`, `/pack`, and `/publish` sub-actions to set the current working directory to execute Changesets in. This input existed in v1 but was incorrectly removed.
|
||||
@@ -62,6 +62,7 @@ If using [trusted publishing](https://docs.npmjs.com/trusted-publishers), it's r
|
||||
| `create-github-releases` | Whether to create Github releases after publish |
|
||||
| `push-git-tags` | Whether to create git tags after publish. If `create-github-releases` is set to `true`, this option will also always be `true`. |
|
||||
| `push-with-git-cli` | Whether to use the Git CLI instead of the GitHub API to push release commits and tags. Defaults to `false`. When using the GitHub API, commits and tags are signed using GitHub's GPG key and attributed to the user or app that owns the `github-token`. |
|
||||
| `cwd` | The working directory to execute Changesets in. Defaults to the root of the repository. |
|
||||
|
||||
| Outputs | Description |
|
||||
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
|
||||
@@ -47,6 +47,9 @@ inputs:
|
||||
GitHub's GPG key and attributed to the user or app that owns the `github-token`.
|
||||
required: false
|
||||
default: false
|
||||
cwd:
|
||||
description: "The working directory to execute Changesets in. Defaults to the root of the repository."
|
||||
required: false
|
||||
outputs:
|
||||
published:
|
||||
description: A "true" or "false" string value to indicate whether a publishing is happened or not
|
||||
|
||||
+4
-3
@@ -17,9 +17,10 @@ This action packs publishable packages into tarballs, complements [changesets/ac
|
||||
|
||||
<!-- api-start -->
|
||||
|
||||
| Inputs | Description |
|
||||
| -------------------------- | --------------------------------------------------------------------- |
|
||||
| `publish-plan-artifact-id` | Artifact id for a publish plan generated by the select-mode subaction |
|
||||
| Inputs | Description |
|
||||
| -------------------------- | --------------------------------------------------------------------------------------- |
|
||||
| `publish-plan-artifact-id` | Artifact id for a publish plan generated by the select-mode subaction |
|
||||
| `cwd` | The working directory to execute Changesets in. Defaults to the root of the repository. |
|
||||
|
||||
| Outputs | Description |
|
||||
| ---------------------- | ------------------------------------------- |
|
||||
|
||||
@@ -7,6 +7,9 @@ inputs:
|
||||
publish-plan-artifact-id:
|
||||
description: "Artifact id for a publish plan generated by the select-mode subaction"
|
||||
required: false
|
||||
cwd:
|
||||
description: "The working directory to execute Changesets in. Defaults to the root of the repository."
|
||||
required: false
|
||||
outputs:
|
||||
pack-dir-artifact-id:
|
||||
description: "Artifact id for the packed output directory"
|
||||
|
||||
@@ -25,6 +25,7 @@ This action publishes packages to npm.
|
||||
| `pack-dir-artifact-id` | Artifact id for packed publish output generated by the pack subaction |
|
||||
| `create-github-releases` | Whether to create Github releases after publish |
|
||||
| `push-git-tags` | Whether to create git tags after publish. If `create-github-releases` is set to `true`, this option will also always be `true`. |
|
||||
| `cwd` | The working directory to execute Changesets in. Defaults to the root of the repository. |
|
||||
|
||||
| Outputs | Description |
|
||||
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
|
||||
@@ -26,6 +26,9 @@ inputs:
|
||||
this option will also always be `true`.
|
||||
required: false
|
||||
default: true
|
||||
cwd:
|
||||
description: "The working directory to execute Changesets in. Defaults to the root of the repository."
|
||||
required: false
|
||||
outputs:
|
||||
published:
|
||||
description: A "true" or "false" string value to indicate whether a publishing has happened or not
|
||||
|
||||
@@ -20,7 +20,9 @@ This action selects the mode to run a Changesets workflow:
|
||||
|
||||
<!-- api-start -->
|
||||
|
||||
Inputs: _none_
|
||||
| Inputs | Description |
|
||||
| ------ | --------------------------------------------------------------------------------------- |
|
||||
| `cwd` | The working directory to execute Changesets in. Defaults to the root of the repository. |
|
||||
|
||||
| Outputs | Description |
|
||||
| -------------------------- | ---------------------------------------------------------------------------- |
|
||||
|
||||
@@ -3,7 +3,10 @@ description: Whether to version or publish in the current repo state
|
||||
runs:
|
||||
using: node24
|
||||
main: ../dist/select-mode.js
|
||||
inputs: {}
|
||||
inputs:
|
||||
cwd:
|
||||
description: "The working directory to execute Changesets in. Defaults to the root of the repository."
|
||||
required: false
|
||||
outputs:
|
||||
mode:
|
||||
description: "The mode to use for the current repo state: 'version', 'publish', or 'none'."
|
||||
|
||||
+1
-2
@@ -11,8 +11,7 @@ import {
|
||||
} from "./utils.ts";
|
||||
|
||||
(async () => {
|
||||
// If the user needs to change the cwd, set `working-directory` in the step instead
|
||||
const cwd = process.cwd();
|
||||
const cwd = getOptionalInput("cwd") || process.cwd();
|
||||
await validateChangesetsCliVersion(cwd);
|
||||
|
||||
throwOnRenamedInputs({
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ try {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
// If the user needs to change the cwd, set `working-directory` in the step instead
|
||||
const cwd = process.cwd();
|
||||
const cwd = getOptionalInput("cwd") || process.cwd();
|
||||
await validateChangesetsCliVersion(cwd);
|
||||
|
||||
const publishPlanArtifactId = getOptionalInput("publish-plan-artifact-id");
|
||||
|
||||
@@ -17,8 +17,7 @@ try {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
// If the user needs to change the cwd, set `working-directory` in the step instead
|
||||
const cwd = process.cwd();
|
||||
const cwd = getOptionalInput("cwd") || process.cwd();
|
||||
await validateChangesetsCliVersion(cwd);
|
||||
|
||||
const githubToken = getRequiredInput("github-token");
|
||||
|
||||
@@ -4,7 +4,11 @@ import path from "node:path";
|
||||
import artifact from "@actions/artifact";
|
||||
import * as core from "@actions/core";
|
||||
import readChangesetState from "../readChangesetState.ts";
|
||||
import { execChangesetsCli, validateChangesetsCliVersion } from "../utils.ts";
|
||||
import {
|
||||
execChangesetsCli,
|
||||
getOptionalInput,
|
||||
validateChangesetsCliVersion,
|
||||
} from "../utils.ts";
|
||||
|
||||
type ModeResult =
|
||||
| {
|
||||
@@ -27,7 +31,7 @@ try {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const cwd = process.cwd();
|
||||
const cwd = getOptionalInput("cwd") || process.cwd();
|
||||
await validateChangesetsCliVersion(cwd);
|
||||
|
||||
const result = await getMode(cwd);
|
||||
|
||||
@@ -15,8 +15,7 @@ try {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
// If the user needs to change the cwd, set `working-directory` in the step instead
|
||||
const cwd = process.cwd();
|
||||
const cwd = getOptionalInput("cwd") || process.cwd();
|
||||
await validateChangesetsCliVersion(cwd);
|
||||
throwOnRemovedCommitModeInput();
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ This action versions packages and creates or updates a pull request with the cha
|
||||
| `pr-draft` | Controls draft PR behavior. Use 'create' to create new version PRs as draft, or 'always' to also convert existing version PRs back to draft when updating them. |
|
||||
| `pr-base-branch` | Sets the base branch of the PR. Defaults to `github.ref_name`. |
|
||||
| `push-with-git-cli` | Whether to use the Git CLI instead of the GitHub API to push release commits. Defaults to `false`. When using the GitHub API, commits are signed using GitHub's GPG key and attributed to the user or app that owns the `github-token`. |
|
||||
| `cwd` | The working directory to execute Changesets in. Defaults to the root of the repository. |
|
||||
|
||||
| Outputs | Description |
|
||||
| ----------- | --------------------------------------------------- |
|
||||
|
||||
@@ -34,6 +34,9 @@ inputs:
|
||||
GPG key and attributed to the user or app that owns the `github-token`.
|
||||
required: false
|
||||
default: false
|
||||
cwd:
|
||||
description: "The working directory to execute Changesets in. Defaults to the root of the repository."
|
||||
required: false
|
||||
outputs:
|
||||
pr-number:
|
||||
description: The pull request number that was created or updated
|
||||
|
||||
Reference in New Issue
Block a user