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

Error: Invalid format '├── https://github.com/sponsors/broofa' #237

Closed
sernaferna opened this issue Feb 5, 2024 · 19 comments · Fixed by #241
Closed

Error: Invalid format '├── https://github.com/sponsors/broofa' #237

sernaferna opened this issue Feb 5, 2024 · 19 comments · Fixed by #241

Comments

@sernaferna
Copy link

Getting the error listed above at the tail end of execution. The entire job seems to be running successfully (i.e. there is a message that says "✔ success Version bumped!"), but then there is an error about being unable to process file command 'output' successfully.

Full log:

process.env.GITHUB_WORKSPACE /home/runner/work/<appname>/<appname>/apps/<msname>
tagPrefix: 
tagSuffix: 
commit messages: [
  'force build\nundefined',
  'Merge pull request #1348 from sernaferna/bnd\n\nforce build\nundefined'
]
config words: {
  majorWords: [ 'MAJOR' ],
  minorWords: [ 'MINOR' ],
  patchWords: null,
  preReleaseWords: [ 'pre-alpha', 'pre-beta', 'pre-rc' ]
}
version action after first waterfall: patch
version action after final decision: patch
runInWorkspace | command: git args: [ 'config', 'user.name', '"Automated Version Bump"' ]
runInWorkspace | command: git args: [
  'config',
  'user.email',
  '"[email protected]"'
]
currentBranch: main
runInWorkspace | command: npm args: [
  'version',
  '--allow-same-version=true',
  '--git-tag-version=false',
  '6.1.5'
]
current 1: 6.1.5 / version: patch
newVersion 1:   run `npm fund` for details
runInWorkspace | command: git args: [
  'commit',
  '-a',
  '-m',
  'ci: version bump to   run `npm fund` for details'
]
runInWorkspace | command: git args: [ 'checkout', 'main' ]
runInWorkspace | command: npm args: [
  'version',
  '--allow-same-version=true',
  '--git-tag-version=false',
  '6.1.5'
]
current 2: 6.1.5 / version: patch
execute npm version now with the new version: patch
newVersion 2:   run `npm fund` for details
newVersion after merging tagPrefix+newVersion+tagSuffix:   run `npm fund` for details
runInWorkspace | command: sh args: [
  '-c',
  'echo "newTag=  run `npm fund` for details" >> $GITHUB_OUTPUT'
]
runInWorkspace | command: git args: [
  'commit',
  '-a',
  '-m',
  'ci: version bump to   run `npm fund` for details'
]
git commit failed because you are using "actions/checkout@v2" or later; but that doesnt matter because you dont need that git commit, thats only for "actions/checkout@v1"
runInWorkspace | command: git args: [
  'push',
  '***github.com/sernaferna/<appname>.git'
]
✔  success   Version bumped!
##[error]Unable to process file command 'output' successfully.
##[error]Invalid format '├── https://github.com/sponsors/broofa'

There is an error about a git commit failing, too, but I don't think that's causing the problem -- I could be wrong.

This is for a smaller microservice within a larger monorepo; the relevant section of the YAML is:

  bump-versions:
    needs: paths-filter
    name: Bump version numbers
    runs-on: ubuntu-latest

    steps:
      - name: Checkout source code
        uses: actions/checkout@v4
        with:
          ref: ${{ github.ref }}

      - name: Bump version for <msname>
        uses: phips28/gh-action-bump-version@master
        if: ${{ needs.paths-filter.outputs.msname == 'true' }}
        with:
          target-branch: 'main'
          skip-tag: 'true'
          major-wording: 'MAJOR'
          minor-wording: 'MINOR'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          PACKAGEJSON_DIR: 'apps/msname'
          GITHUB_REF: ${{ github.ref}}

      - name: Bump version for Workspace
        uses: phips28/gh-action-bump-version@master
        with:
          target-branch: 'main'
          major-wording: 'MAJOR'
          minor-wording: 'MINOR'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_REF: ${{ github.ref}}
@whiplashwebb
Copy link

+1 Seeing the same issue. I've locked the version on all the flows where i use this action like this:

        uses: "phips28/[email protected]"

and got back on track.

@mbret
Copy link

mbret commented Feb 20, 2024

I have the same kind of issue but with mui

image

monorepo as well btw. Using a fixed version did not fix my issue.

@mbret
Copy link

mbret commented Feb 21, 2024

Okay so it seems that using 10.1.1 works but not v11

@phips28
Copy link
Owner

phips28 commented Feb 21, 2024

do you see anything obviously broken in this PR? https://github.com/phips28/gh-action-bump-version/pull/232/files

this was the last merge before bumping to v11.

@mattanglin can you help please?

@psamusev
Copy link

Same issue to me and again using yarn workspaces

@mbret
Copy link

mbret commented Feb 21, 2024

The culprit seems to be parseNpmVersionOutput. It does returns an invalid version number I think due to some weirdness in the outpout

@mbret
Copy link

mbret commented Feb 21, 2024

I mean everything else seems to be just linting

@sernaferna
Copy link
Author

Not to be "that guy," but is a fix in the works? 🙂 It's been a couple of weeks since the last comment.

I'd love to get up to a version of the action that's on Node 20, but the current version breaks my build pipeline.

@phips28
Copy link
Owner

phips28 commented Mar 10, 2024

@mbret @sernaferna for me the action works properly, so there might be some packages/setup in your repo that breaks that flow.

can you test uses: 'phips28/gh-action-bump-version@fix-237-invalid-format'

I added some logs to check what your repo outputs:
image
This is my test repo: https://github.com/phips28/test-gh-action-bump-version/actions/runs/8221259292/job/22481416426#step:4:60

And can you share your package.json dependencies so I can reproduce it?

@sernaferna
Copy link
Author

Sorry for the delay, haven't been in my home office.

This is a monorepo with 8 sub-projects and some of them have a ton of dependencies, but before we go down that path, the logs might be enough on their own because my output looks different from yours. For reference, this is for a monorepo called soulhx and the sub-project is also named soulhx:

[parseNpmVersionOutput] output: soulhx
v13.0.26

up to date in 3s

302 packages are looking for funding
 run `npm fund` for details

[parseNpmVersionOutput] npmVersionStr:   run `npm fund` for details
newVersion 1:   run `npm fund` for details

@mbret
Copy link

mbret commented Mar 14, 2024

yeah im not sure we need to reproduce, I believe there are some weird characters in some of the repo (mine was mui) which seems to break some code. You can try to add mui to see if you can reproduce. Maybe something related to the "|--"

@phips28
Copy link
Owner

phips28 commented Mar 14, 2024

@sernaferna thx, that log helps a lot, and already shows whats going wrong.

this is the produced output of npm version --git-tag-version=false ${version}

[parseNpmVersionOutput] output: soulhx
v13.0.26

up to date in 3s

302 packages are looking for funding
 run `npm fund` for details

you see its adding all the stuff like up to date, funding stuff...

and then const npmVersionStr = output.trim().split(EOL).pop(); gets the last line of it:

[parseNpmVersionOutput] npmVersionStr:   run `npm fund` for details

and thats not a correct version ofc... we want v13.0.26.

do you have any preversion npm scripts that does a npm install for example? that could be the reason.

@phips28
Copy link
Owner

phips28 commented Mar 14, 2024

can you test again with uses: 'phips28/gh-action-bump-version@turn-off-npm-fund'
this turns off the fund message.

@sernaferna
Copy link
Author

I'm not doing an npm install anywhere before this script runs; my YAML does the following:

  1. Job to get changed apps (further jobs use this output to only bump/build/deploy changed apps)
    1. checkout@v4
    2. dorny/paths-filter@v3
  2. Job to Bump versions
    1. checkout@v4
    2. phips28/gh-action-bump-version
  3. Job to build and deploy App 1
  4. Job to build and deploy App 2
  5. ...

As for the new version, it doesn't work with npm workspaces.

npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2024-03-15T15_21_29_725Z-debug-0.log
✖  fatal     Error: Command failed: npm config set fund false
npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.

npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/2024-03-15T15_21_29_725Z-debug-0.log

    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at /home/runner/work/_actions/phips28/gh-action-bump-version/turn-off-npm-fund/index.js:201:5
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
✖  fatal     Failed to bump version

@phips28
Copy link
Owner

phips28 commented Mar 16, 2024

@sernaferna can you try again with uses: 'phips28/gh-action-bump-version@turn-off-npm-fund'
I pushed a fix to use runInWorkspace

@sernaferna
Copy link
Author

sernaferna commented Mar 16, 2024

Unfortunately it still doesn't work in a workspace. 🙁

Here's a slightly longer version of the log; to make things a little clearer I attempted with an application that doesn't have the same name as the workspace. 🙂 So in this case it's workspace soulhx and application papi.

process.env.GITHUB_WORKSPACE /home/runner/work/soulhx/soulhx/apps/papi
tagPrefix: 
tagSuffix: 
commit messages: [
  'new attempt for bumping\nundefined',
  'Merge pull request #1437 from sernaferna/bump\n' +
    '\n' +
    'new attempt for bumping\n' +
    'undefined'
]
config words: {
  majorWords: [ 'MAJOR' ],
  minorWords: [ 'MINOR' ],
  patchWords: null,
  preReleaseWords: [ 'pre-alpha', 'pre-beta', 'pre-rc' ]
}
version action after first waterfall: patch
version action after final decision: patch
runInWorkspace | command: git args: [ 'config', 'user.name', '"Automated Version Bump"' ]
runInWorkspace | command: git args: [
  'config',
  'user.email',
  '"[email protected]"'
]
currentBranch: main
runInWorkspace | command: npm args: [ 'config', 'set', 'fund', 'false' ]
✖  fatal     npm ERR! code ENOWORKSPACES
npm ERR! This command does not support workspaces.
npm ERR! A complete log of this run can be found in: /home/runner/.npm/_logs/20[24](https://github.com/sernaferna/soulhx/actions/runs/8308005489/job/22737785808#step:5:25)-03-16T13_08_[34](https://github.com/sernaferna/soulhx/actions/runs/8308005489/job/22737785808#step:5:35)_978Z-debug-0.log
npm exited with code 1
✖  fatal     Failed to bump version

@phips28
Copy link
Owner

phips28 commented Mar 16, 2024

ok pushed another change for workspaces, try again

@sernaferna
Copy link
Author

Works! 🙂

@phips28
Copy link
Owner

phips28 commented Mar 16, 2024

Thats great. Then I will merge later and create a new release

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

Successfully merging a pull request may close this issue.

5 participants