Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

publish option does not support multiple bash commands #225

Open
kachkaev opened this issue Oct 14, 2022 · 1 comment
Open

publish option does not support multiple bash commands #225

kachkaev opened this issue Oct 14, 2022 · 1 comment

Comments

@kachkaev
Copy link

kachkaev commented Oct 14, 2022

Example yaml

      - name: Create Release Pull Request or Publish to npm
        uses: changesets/[email protected]
        with:
          publish: echo "hello world" && yarn changeset publish
        env:
          GITHUB_TOKEN: ${{ secrets.MACHINE_USER_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Expected behavior

The action runs echo "hello world" and then yarn changeset publish, unless the first command exits with non-zero. Thus, syntax parsing matches package.jsonscripts.

Observed behavior

The action runs echo "hello world" "&&" "yarn" "changeset" "publish".

Context

Action version: v1.3.0

Related source:

action/src/run.ts

Lines 76 to 89 in 8c3f5f5

export async function runPublish({
script,
githubToken,
createGithubReleases,
cwd = process.cwd(),
}: PublishOptions): Promise<PublishResult> {
let octokit = github.getOctokit(githubToken);
let [publishCommand, ...publishArgs] = script.split(/\s+/);
let changesetPublishOutput = await execWithOutput(
publishCommand,
publishArgs,
{ cwd }
);

@lawvs
Copy link

lawvs commented Oct 17, 2022

I have the same problem, the action run build cmd but skips publish cmd.

I workaround it by merging the build script and the publish to an npm script. lawvs/poi-plugin-quest-2@caf000f


Incorrect action see https://github.com/lawvs/poi-plugin-quest-2/actions/runs/3262382860/workflow

      - name: Create Release Pull Request or Publish to npm
        id: changesets
        uses: changesets/action@v1
        with:
          publish: npm run build && npm publish  # <- the publish script was skipped
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
No changesets found, attempting to publish any unpublished packages to npm
No user .npmrc file found, creating one
/opt/hostedtoolcache/node/16.17.1/x64/bin/npm run build && npm publish

> [email protected] build
> npm run convertAssets && npm run update

// ...... ...

New Version Detected. Version: [20](https://github.com/lawvs/poi-plugin-quest-2/actions/runs/3262382860/jobs/5359455750#step:5:21)[22](https://github.com/lawvs/poi-plugin-quest-2/actions/runs/3262382860/jobs/5359455750#step:5:23)091101

New Version Detected. Version: 6b8[25](https://github.com/lawvs/poi-plugin-quest-2/actions/runs/3262382860/jobs/5359455750#step:5:26)0e6da4f[38](https://github.com/lawvs/poi-plugin-quest-2/actions/runs/3262382860/jobs/5359455750#step:5:39)9dffcdecdecc72de68f0fe1beb

/usr/bin/git push origin --tags
Everything up-to-date

And the correct output is like in here https://github.com/lawvs/poi-plugin-quest-2/actions/runs/3262903759/jobs/5360750330

kwaa added a commit to importantimport/shiraha that referenced this issue Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants