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

Link checker github action step is broken #645

Open
konstin opened this issue Sep 29, 2023 · 2 comments · Fixed by #647
Open

Link checker github action step is broken #645

konstin opened this issue Sep 29, 2023 · 2 comments · Fixed by #647
Assignees
Milestone

Comments

@konstin
Copy link

konstin commented Sep 29, 2023

Workflow file: https:/konstin/virtualenv-rs/blob/b68641227aef9e3dbccad15f3d8407c1aceaa109/.github/workflows/web.yml
Run: https:/konstin/gourgeist/actions/runs/6355674453/job/17264084654
Error message:

Run /home/runner/work/_actions/untitaker/hyperlink/0.1.29/scripts/hyperlink-bin /tmp/public/ --sources docs/ --github-actions
[...]
Reading files
Checking 34 links from 11 files (4 documents)
Found some broken links, reading source files
Error: IO error for operation on docs/: No such file or directory (os error 2)

I can reproduce this locally:

$ oranda build
↪ >o_o< INFO: Building components: artifacts, changelog
✓ >o_o< SUCCESS: Your site build is located in `public`.
$ mkdir /tmp/public/ && cp -R public /tmp/public/oranda
$ npx @untitaker/hyperlink /tmp/public/ --sources docs/
Reading files
Checking 34 links from 11 files (4 documents)
Found some broken links, reading source files
Error: IO error for operation on docs/: No such file or directory (os error 2)

Caused by:
    No such file or directory (os error 2)
@m-lamonaca
Copy link

The error appears to be still happening.

Repro steps (emulate the CI):

$ oranda --version
oranda 0.5.0
$ oranda build
↪ >o_o< INFO: Building components: artifacts, changelog
✓ >o_o< SUCCESS: Your site build is located in `public`.
$ mkdir /tmp/public/ && cp -R public /tmp/public/oranda
$ hyperlink /tmp/public/
Reading files
Checking 34 links from 11 files (4 documents)
/tmp/public/oranda/artifacts/index.html
  error: bad link /
  error: bad link /artifacts
  error: bad link /artifacts.js
  error: bad link /changelog
  error: bad link /favicon.ico
  error: bad link /<project>-installer.ps1.txt
  error: bad link /<project>-installer.sh.txt
  error: bad link /oranda-v0.5.0.css

/tmp/public/oranda/changelog/index.html
  error: bad link /
  error: bad link /artifacts
  error: bad link /artifacts.js
  error: bad link /changelog
  error: bad link /changelog.rss
  error: bad link /favicon.ico
  error: bad link /oranda-v0.5.0.css

/tmp/public/oranda/changelog/v0.1.0/index.html
  error: bad link /
  error: bad link /artifacts
  error: bad link /changelog
  error: bad link /favicon.ico
  error: bad link /oranda-v0.5.0.css

/tmp/public/oranda/index.html
  error: bad link /
  error: bad link /artifacts
  error: bad link /artifacts.js
  error: bad link /changelog
  error: bad link /favicon.ico
  error: bad link /<project>-installer.ps1.txt
  error: bad link /<project>-installer.sh.txt
  error: bad link /oranda-v0.5.0.css

Found 32 bad links

The correct command seems to be:

$ hyperlink /tmp/public/oranda
Reading files
Checking 34 links from 11 files (4 documents)
Found 0 bad links

@m-lamonaca
Copy link

m-lamonaca commented Oct 18, 2023

On further experimentation I found that this does not work if build.prefix_path or build.dist_dir are set.

The correct command is probably:

$ mkdir /tmp/{build.dist_dir}/{build.path_prefix} 
$ cp -R {build.dist_dir} /tmp/{build.dist_dir}/{build.path_prefix}

# This is optional if build.path_prefix is empty/default but is necessary otherwise
# since the hrefs will be like /{build.path_prefix}/artifacts.js
$ cp {build.dist_dir}/index.html /tmp/{build.dist_dir}/index.html

$ hyperlink /tmp/{build.dist_dir}/{build.path_prefix}

Here you can find an example of a patched workflow that works.

Unfortunately, I have zero ideas on how to actually implement this, sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants