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

fix: Add default workspace to github message marker #3082

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-linter.yml file, or with `oxsecurity/megalinter:beta` docker image

- Core
- Handle GitHub comment markers for multiple MegaLinter workflows in the same repo

- Media

Expand Down
7 changes: 6 additions & 1 deletion megalinter/reporters/GithubCommentReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,16 @@ def comment_marker(self):

"""
workflow = os.getenv("GITHUB_WORKFLOW")
github_workspace = os.getenv("GITHUB_WORKSPACE")
workspace = config.get(self.master.request_id, "DEFAULT_WORKSPACE", github_workspace)
if github_workspace is None or workspace == github_workspace:
workspace = None
jobid = os.getenv("GITHUB_JOB")
workflow = workflow and f"workflow={workflow!r}"
jobid = jobid and f"jobid={jobid!r}"
workspace = workspace and f"workspace={workspace!r}"
identifier = " ".join(
["github-comment-reporter", *filter(None, (workflow, jobid))]
["github-comment-reporter", *filter(None, (workflow, jobid, workspace))]
)
return f"<!-- megalinter: {identifier} -->"

Expand Down
Loading