peter-evans / link-checker

A GitHub action for link checking repository Markdown and HTML files
MIT License
49 stars 11 forks source link

Getting a "body is too long" Error Message When Creating the GitHub Issue #30

Closed praneesha closed 4 years ago

praneesha commented 4 years ago

@peter-evans - I have configured the link-checker as follows:

on: [push]
name: Check markdown links
jobs:
  linkChecker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Link Checker
        id: lc
        uses: peter-evans/link-checker@v1
      - name: Create Issue From File
        uses: peter-evans/create-issue-from-file@v2
        with:
          title: Link Checker Report
          content-filepath: ./link-checker/out.md
          labels: report, automated issue
          assignees: praneesha
      - name: Fail if there were link errors
        run: exit ${{ steps.lc.outputs.exit_code }}

I am getting the below error.

github.GithubException.GithubException: 422 {"message": "Validation Failed", "errors": [{"resource": "Issue", "code": "custom", "field": "body", "message": "body is too long (maximum is 65536 characters)"}], "documentation_url": "https://docs.github.com/rest/reference/issues#create-an-issue"}

How can I get this resolved?

peter-evans commented 4 years ago

Hi @praneesha

I don't know if there is anything I can do to help in this situation. The link-checker action is producing output which is larger than the maximum allowed by GitHub issues. This causes the create-issue-from-file action to fail with the above message. One option is to limit the scope of what the link-checker is doing. Perhaps split the work into two different jobs that would make two issues instead of one.

praneesha commented 4 years ago

@peter-evans - I removed the problematic step of creating the GitHub issue as follows.

on: [push]
name: Check markdown links
jobs:
  linkChecker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Link Checker
        id: lc
        uses: peter-evans/link-checker@v1
      - name: Fail if there were link errors
        run: exit ${{ steps.lc.outputs.exit_code }}

Now, the GitHub Action exits with the above message.

Screenshot 2020-10-20 at 11 09 16

But, I don't see the ./link-checker/out.md file created. Where can I see the link checker report?

peter-evans commented 4 years ago

The file only exists on the Actions runner while the workflow is being executed. You need to do something with the file during the workflow, such as create an issue using the content. Alternatively, you could perhaps email the file to yourself. See sendgrid-action if you want to try that.

praneesha commented 4 years ago

@peter-evans - I have configured SendGrid as follows:

on: [push]
name: Link Checker Example Command
jobs:
  linkChecker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Link Checker
        id: lc
        uses: peter-evans/link-checker@v1
      - name: SendGrid
        uses: peter-evans/sendgrid-action@v1
        env:
          SENDGRID_API_KEY: <MY-KEY>
          SCRIPT_FILEPATH: ./scripts/sendgrid.js

The SendGrid step fails with the error below:

Screenshot 2020-10-27 at 22 03 15

Any advice on how to get this resolved?

peter-evans commented 4 years ago

@praneesha Make sure the script file is executable.

Execute this command to make it executable and check the file mode change into git.

chmod +x ./scripts/sendgrid.js
praneesha commented 4 years ago

@peter-evans - Instead of using SendGrid, I managed to upload the ./link-checker/out.md file as a GitHub Actions artifact it as follows:

on: [push]
name: Link Checker Example Command
jobs:
  linkChecker:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Link Checker
        id: lc
        uses: peter-evans/link-checker@v1
      - name: Archive production artifacts
        uses: actions/upload-artifact@v2
        with:
          name: Link Checker Report
          path:  ./link-checker/out.md

Therefore, I am closing this issue. Thank you so much for all the replies above!