changesets / action

709 stars 251 forks source link

action formatting package.json in wrong way #366

Open technophile-04 opened 6 months ago

technophile-04 commented 6 months ago

Description :

When the "Version Packages" PR is created it updates the package.json version but also formats other fields in the wrong way.

Screenshot 2024-04-28 at 10 41 30 PM

It's not respecting my biome.json config and instead I think its using prettier to format the file

errmayank commented 5 months ago

Found a way to fix this, in the action's "Create a release pull request" step you can add a custom script using version

BUT it fails for some reason if you add the format script right there, like if you do this

# release.yml

- name: "Create a release pull request"
  uses: changesets/action@v1
  with:
    commit: "chore(release): version packages"
    title: "chore(release): version packages"
    version: pnpm changeset version && pnpm format
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

So instead create a separate script that does both and add it there

/* package.json */

  "scripts": {
    "format": "prettier --write \"**/*.{svelte,js,cjs,mjs,ts,cts,mts,json,md,yaml,yml}\"",
    "changeset-add": "changeset add",
    "changeset-status": "changeset status --verbose",
    "changeset-version": "changeset version && pnpm format"
  },
# release.yml

- name: "Create a release pull request"
  uses: changesets/action@v1
  with:
    commit: "chore(release): version packages"
    title: "chore(release): version packages"
    version: pnpm changeset-version
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}