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

GitHub Comment reporter fails to find existing comment when using a CI other than GitHub #1355

Closed
mjpieters opened this issue Mar 26, 2022 · 2 comments · Fixed by #1356
Closed

Comments

@mjpieters
Copy link
Contributor

mjpieters commented Mar 26, 2022

The GitHub Comment reporter identifies a pre-existing Mega-Linter comment in a PR by looking for a specific line of text:

https://github.com/megalinter/megalinter/blob/abfb0dccab7ff24e8ac4363a1616df83babf97a3/megalinter/reporters/GithubCommentReporter.py#L88-L93

However, that line of text is only going to be there if the comment was posted from a GitHub action runner, because only then a non-empty action_run_url value has been passed to build_markdown_summary(). If that variable is an empty string, the text that is included is different:

https://github.com/megalinter/megalinter/blob/abfb0dccab7ff24e8ac4363a1616df83babf97a3/megalinter/utils_reporter.py#L88-L94

We are using Jenkins (where we provide enough context and a token for the reporter to run successfully), but each PR update triggers a new comment.

The check seems to be very fragile in any case. Perhaps the reporter could include a HTML comment with a know identifier, instead? E.g. append ”\n\n<!— mega_linter_github_comment_reporter comment marker —> to the generated markdown and look for that text instead?

The marker could even incorporate the workflow name (GITHUB_WORKFLOW) and jobid (GITHUB_JOB), if set, to make it possible to run more than one MegaLinter job per PR.

@nvuillam
Copy link
Member

Good catch, and good proposition, I check the PR :)

@nvuillam
Copy link
Member

You can now test with megalinter/megalinter:beta :) ( of beta versions of flavors docker images ^^ )

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