Skip to content

Problem matcher issue #26

@jonasbn

Description

@jonasbn

Hello,

I am a very happy user of the Markdownlint GitHub Action. The latest release 3.0.0 does however give me some problems, since all of my PRs from @dependabot fail their builds with the following error:

Error: Unable to process command '::add-matcher::.github/markdownlint-problem-matcher.json' successfully.
Error: Could not find file '/home/runner/work/ebirah/ebirah/.github/markdownlint-problem-matcher.json'.

Problem matchers are awesome and I am welcoming the addition, but the implementation does not seem to take into consideration, that the problem matcher is not available to the consumers of the GitHub Action.

I attempted to add the referenced file one of my repositories and it worked

{
  "problemMatcher": [
    {
      "owner": "markdownlint",
      "pattern": [
        {
          "code": 3,
          "file": 1,
          "line": 2,
          "message": 4,
          "regexp": "^(.+):(\\d+)(?:\\d+)? (\\S+) (.+)$"
        }
      ]
    }
  ]
}

The problem seem to be this line:

echo '::add-matcher::.github/markdownlint-problem-matcher.json'

This file is not available in consuming repositories and the documentation does not describe that it should be added.

I would love to write a PR with an update to the documentation, but before doing so I would rather point you to the problem matcher I use with a xmllint based GitHub Action. The configuration looks as follows:

name: XMLlint Action
on: push

jobs:
  build:
    name: XMLlint
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: korelstar/xmllint-problem-matcher@v1
    # This step references the directory that contains the action.
    - uses: ./.github/actions/xmllint

You can find the file here

It references the external problem matcher and simply uses it. The problem matcher lives in its own repository.

The interesting part comes from it's documentation:

Add the step to your workflow, before xmllint is called.

Meaning this line:

    - uses: korelstar/xmllint-problem-matcher@v1

Should come before this one:

    - uses: ./.github/actions/xmllint

The beauty is in the composition.

Please have a look at how it was solves there, since it might be an inspiration. Else I guess the key is in this in the "korelstar / xmllint-problem-matcher" implementation:

console.log(`::add-matcher::${__dirname}/xmllint-matcher.json`);

I am by no means an expert on problem matcher, but I will gladly help if I can, also because I am a heavy user of this GitHub Action.

As I stated I got it to work for one of my repositories, but I would prefer not that have to maintain the problem matcher in all of my repositories, since it is more closely bound to the actual action that to the consumers.

Please let me know if you need additional information from me - take care and stay safe and thanks for the awesome action.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions