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

Problem matcher issue #26

Closed
jonasbn opened this issue Dec 20, 2021 · 2 comments · Fixed by #27
Closed

Problem matcher issue #26

jonasbn opened this issue Dec 20, 2021 · 2 comments · Fixed by #27
Labels
bug Something isn't working

Comments

@jonasbn
Copy link

jonasbn commented Dec 20, 2021

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.

@nosborn nosborn added the bug Something isn't working label Dec 20, 2021
@nosborn nosborn linked a pull request Dec 21, 2021 that will close this issue
@nosborn
Copy link
Owner

nosborn commented Dec 21, 2021

Thanks for the detailed issue @jonasbn. This should be fixed in v3.0.1.

The problem matcher is intended to work out-of-the-box without any changes to the calling workflow and replaces code in the action that previously commented on PRs. Unfortunately, I did this in a manner that only worked for the tests in this repository and so, as you observed, it wasn't available to consumers of the action. 🤦

Apologies for the bad release.

jonasbn added a commit to jonasbn/bash_completion_perlbrew that referenced this issue Dec 21, 2021
@jonasbn
Copy link
Author

jonasbn commented Dec 21, 2021

Hi @nosborn

I have just confirmed that 3.0.1 works in one of my repositories. I expect to hear from @dependabot one of the coming days :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants