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

Markdown link checking isn't working #170

Closed
chalin opened this issue Oct 16, 2023 · 1 comment · Fixed by #196
Closed

Markdown link checking isn't working #170

chalin opened this issue Oct 16, 2023 · 1 comment · Fixed by #196

Comments

@chalin
Copy link
Contributor

chalin commented Oct 16, 2023

The current config breaks the checking, and makes the tool report status 0 for all links (w/o checking anything). For proof see:

/cc @svrnm

@tpaschalis
Copy link
Member

I'm lead to believe this is due to the empty ignorePatterns we're passing on the config file for this action. https://github.com/open-telemetry/opamp-spec/blob/main/.markdown_link_check_config.json#L2-L5

The code that is used to ignore on the markdown-link-check library can be found here.

https://github.com/tcort/markdown-link-check/blob/71ccb4129a1fa86f6904f35c1b26348dfce1438d/index.js#L99-L110

If I take the code and run the following snippet on any JS playground, I can see it always output true for any link passed.

ignorePatterns = [{}];
// nonEmptyignorePatterns = [{"pattern": "https://github.com/.*"}];

const link = "https://somerandomlink.com"
const shouldIgnore = ignorePatterns.some(function(ignorePattern) {
  return ignorePattern.pattern instanceof RegExp ? ignorePattern.pattern.test(link) : (new RegExp(ignorePattern.pattern)).test(link) ? true : false;
});


// Log to console
console.log(shouldIgnore)

That seems like the case when I'm running the command by hand; if I remove the ignorePatterns field the check is returned properly.

$ npx --no -- markdown-link-check --config .markdown_link_check_config.json specification.md

FILE: specification.md
  [/] https://github.com/open-telemetry/community/blob/47813530864b9fe5a5146f466a58bd2bb94edc72/maturity-matrix.yaml#L57
  [/] #introduction
...
  [/] https://datatracker.ietf.org/doc/draft-moriarty-acme-client/
  [/] https://aws.amazon.com/elasticloadbalancing/features/
  [/] https://cloud.google.com/appengine/docs/flexible/go/using-websockets-and-session-affinity
  [/] https://docs.microsoft.com/en-us/azure/application-gateway/application-gateway-websocket

  214 links checked.

I'll open a PR to get the action and the broken links fixed.

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.

2 participants