open-telemetry / opamp-spec

OpAMP Specification
Apache License 2.0
102 stars 33 forks source link

Markdown link checking isn't working #170

Closed chalin closed 2 months ago

chalin commented 10 months ago

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 commented 2 months ago

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.