oxsecurity / megalinter

🦙 MegaLinter analyzes 50 languages, 22 formats, 21 tooling formats, excessive copy-pastes, spelling mistakes and security issues in your repository sources with a GitHub Action, other CI tools or locally.
https://megalinter.io
GNU Affero General Public License v3.0
1.81k stars 215 forks source link

Github Comment Reporter - marker not unique, message is overwritten in monorepo context #3068

Open ancosma opened 8 months ago

ancosma commented 8 months ago

Describe the bug When used in the context of monorepo and a single PR, we run same workflow multiple time. Each time the working directory we pass to megalinter is a different one. Because megalinter uses only GITHUB_WORKFLOW and GITHUB_JOB it will overwrite the message created by previous run of the megalinter for other directories.

To Reproduce Steps to reproduce the behavior:

  1. Create a PR
  2. (which) Run a workflow which start same reusable megalinter workflow invoked with 2 different directories

Expected behavior Because we run same workflow but on different folders, we expect to get 2 comments each reporting for the folder in which megalinter ran.

P.S.: In order to make the marker unique, it should include the directory in which megalinter ran. In case you agree with the change, I can create a PR which fixes the issue. Should it be a breaking change or first try to identify the message using the old marker (without directory included) and then try with the marker which uses the directory?

nvuillam commented 8 months ago

@ancosma i'd be delighted to validate such PR, thanks for your offer :)

Kurt-von-Laven commented 8 months ago

@ancosma, we have historically preferred introducing a fallback option to introducing a breaking change. Can you explain why the fallback option would be needed to avoid a breaking change in this case though?

nvuillam commented 8 months ago

If the directory is root, the marker value must remain the same, to avoid a breaking change Extended marker should happen only if the linting root has been overridden :)

Kurt-von-Laven commented 8 months ago

Oh, I see; I was taking that for granted. Yes, that seems like the correct path to me.

github-actions[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale 🤖 label or comment on the issue.