lycheeverse / lychee-action

Github action to check for broken links in Markdown, HTML, and text files using lychee, a fast link checker written in Rust.
https://lychee.cli.rs
Apache License 2.0
323 stars 48 forks source link

Setting `output` arg does not write results to disk #216

Closed onedr0p closed 10 months ago

onedr0p commented 10 months ago

Hi 👋🏼

I have the action set up like this, however it always fails on the Print Output step because it cannot find /tmp/results.md. I've tried setting the output arg to ./lychee/results.md as well but that still does not work. For some reason it seems like the action is not writing the output to the file, meanwhile I see the results in stdout.

      - name: Checkout Default Branch
        uses: actions/checkout@v4

      - name: Scan For Broken Links
        uses: lycheeverse/lychee-action@v1
        with:
          args: --verbose --no-progress --exclude-mail './**/*.md'
          format: markdown
          output: /tmp/results.md

      - name: Print Output
        run: cat /tmp/results.md

      - name: Find Link Checker Issue
        id: find-issue
        shell: bash
        run: |
          issue_number=$( \
              gh issue list \
                  --search "in:title ${{ env.WORKFLOW_ISSUE_TITLE }}" \
                  --state open \
                  --json number \
                  | jq --raw-output '.[0].number' \
          )
          echo "issue-number=${issue_number}" >> $GITHUB_OUTPUT
          echo "${issue_number}"

      - name: Create or Update Issue
        uses: peter-evans/create-issue-from-file@v4
        with:
          title: "${{ env.WORKFLOW_ISSUE_TITLE }}"
          issue-number: "${{ steps.find-issue.outputs.issue-number || '' }}"
          content-filepath: /tmp/results.md
Run cat results.md
  cat results.md
  shell: /usr/bin/bash -e {0}
  env:
    WORKFLOW_ISSUE_TITLE: Link Checker Dashboard 🔗
    lychee_exit_code: 0
cat: /tmp/results.md: No such file or directory
Error: Process completed with exit code 1.
tooomm commented 10 months ago

I ran into the same issue! You probably want to add to #214.

There is a potential fix already suggested in a PR as well. 👍

mre commented 10 months ago

@tooomm, have you tried the fix in the mentioned PR?

tooomm commented 10 months ago

Nope. Will also not get around to it for now.

mre commented 10 months ago

This should be fixed in master now. See https://github.com/lycheeverse/lychee-action/issues/214, https://github.com/lycheeverse/lychee-action/pull/215, https://github.com/lycheeverse/lychee-action/pull/217.