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

Limit markdown to 65535? #118

Open
rakkarage opened this issue Mar 12, 2022 · 4 comments
Open

Limit markdown to 65535? #118

rakkarage opened this issue Mar 12, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@rakkarage
Copy link

rakkarage commented Mar 12, 2022

The markdown output can be over 65535 characters if convert many images, which causes error with peter-evans/create-pull-request@v3 since github body can only be 65535. Fixed with truncate action but perhaps there should/could be a limit built in? I guess it is not limited to just being used for github pull requests tho so maybe not. Thanks.

@rakkarage rakkarage added the bug Something isn't working label Mar 12, 2022
@lfgcampos
Copy link

Similar to #107 ?

@lfgcampos
Copy link

create-pull-request@v6 fixed this: changelog

If the pull request body is truncated due to exceeding the maximum length, the action will now suffix the body with the message "...[Pull request body truncated]" to indicate that the body has been truncated.

I haven't tested myself though but maybe just updating the version used by this action will fix it =)

@JakeSteam
Copy link

JakeSteam commented Feb 18, 2024

@lfgcampos Unfortunately v6 doesn't fix it.

Here's a v4 run, here's a v6 run.

Here's the error that was previously shown:

An error occurred trying to start process '/home/runner/runners/2.313.0/externals/node16/bin/node' with working directory '/home/runner/work/blog-personal/blog-personal'. Argument list too long

Here's the new error:

An error occurred trying to start process '/home/runner/runners/2.313.0/externals/node20/bin/node' with working directory '/home/runner/work/blog-personal/blog-personal'. Argument list too long

@JakeSteam
Copy link

JakeSteam commented Feb 18, 2024

Limiting the variable length within the .yml file is an acceptable workaround. I was only running a one-off job so just used an empty body & echo'd the markdown so that the PR could be successfully created, a proper solution probably includes a cut step or something.

My hacky fix let it successfully create a PR that changed 1,516 files(!) and saved 186MB(!!!). The details can be seen in the "Echo markdown" step of the job.

Here's the full workaround .yml:

# https://github.com/calibreapp/image-actions?tab=readme-ov-file#compress-on-demand-or-on-schedule
name: Compress Images
on:
  workflow_dispatch:
  
jobs:
  build:
    name: calibreapp/image-actions
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v3
      - name: Compress Images
        id: calibre
        uses: calibreapp/image-actions@main
        with:
          githubToken: "${{ secrets.GITHUB_TOKEN }}"
          compressOnly: true
      - name: Echo markdown
        run: echo ${{ steps.calibre.outputs.markdown }}
      - name: Create New Pull Request If Needed
        if: steps.calibre.outputs.markdown != ''
        uses: peter-evans/create-pull-request@v6
        with:
          title: Compressed Images
          branch-suffix: timestamp
          commit-message: Compressed Images
          body: ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants