Describe the bug
The files generated by npx mega-linter-runner --custom-flavor-setup don't
pass MegaLinter when the newly created flavor repository lints itself with the
standard mega-linter.yml workflow. Since the generated repo is a MegaLinter
repo, the first CI run after following the Custom Flavors guide fails.
I hit this setting up a flavor for my own repos and fixed it locally. Happy to
open a PR against the generator templates if that's useful — I didn't want to
send one unprompted in case the strictness here is deliberate.
Findings, all from generators/mega-linter-custom-flavor/templates/:
check-new-megalinter-version.yml and megalinter-custom-flavor-builder.yml
ACTION_ACTIONLINT (ShellCheck SC2086) — 16 findings from unquoted
redirect targets, e.g. echo "tag=$TAG" >> $GITHUB_OUTPUT. Fixed by
quoting: >> "$GITHUB_OUTPUT".
ACTION_ACTIONLINT (ShellCheck SC2129) — the Summary step's consecutive
>> $GITHUB_STEP_SUMMARY writes. Fixed by grouping them into one
{ … } >> "$GITHUB_STEP_SUMMARY".
ACTION_ZIZMOR (unpinned-uses, error) — actions/checkout@v6 and
docker/login-action@v3 aren't hash-pinned.
oxsecurity/megalinter/flavors/custom-builder@main is flagged too, but I
assume that one is deliberate, since the builder needs to track upstream; I
allowed it via an unpinned-uses policy in .github/zizmor.yml rather than
pinning it. A line in the guide mentioning that exception would have saved
me some guessing.
ACTION_ZIZMOR (artipacked) — the builder's checkout step doesn't set
persist-credentials: false.
EDITORCONFIG_EDITORCONFIG_CHECKER — trailing whitespace on 6 lines of
check-new-megalinter-version.yml, plus a 13-space continuation indent at
lines 200-202 where .editorconfig asks for a multiple of 2.
REPOSITORY_CHECKOV (CKV_GHA_7) — "workflow_dispatch inputs MUST be
empty". This one looks unavoidable, since check-new-megalinter-version.yml
dispatches the builder with --field megalinter-version /
--field is-latest. Might be worth a note in the docs that flavor repos
need to skip it.
README.md
MARKDOWN_MARKDOWNLINT (MD024) — the "How to use the custom flavor"
section appears twice, once near the top and once at the bottom.
MARKDOWN_MARKDOWNLINT (MD034) — the repo URL on the "It is built from
official MegaLinter images…" line is a bare URL.
Three unrelated template bugs I noticed while fixing the above
check-new-megalinter-version.yml — the PAT setup instructions say "Choose
this repository (megalinter-custom-flavor-npm-groovy-lint)". Looks like a
leftover from the repo the template was written against; it appears
verbatim in every generated flavor.
check-new-megalinter-version.yml — the Summary step sets
GH_REPO: ${GITHUB_REPOSITORY} in its env: block. That isn't an Actions
expression, so it's passed through as the literal string
${GITHUB_REPOSITORY}. The variable is unused in that step, so nothing
breaks today.
megalinter-custom-flavor-builder.yml — the header comment says the image
lands at ghcr.io/<owner>/<repo>:<tag>, but the actual path is
ghcr.io/<owner>/<repo>/megalinter-custom-flavor:<tag>.
To Reproduce
- Create a repository whose name contains
megalinter-custom-flavor,
containing a normal .github/workflows/mega-linter.yml that lints the repo
with the official action.
- Run
npx mega-linter-runner@9.6.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,MARKDOWN_MARKDOWNLINT,YAML_YAMLLINT
(any linter set works — the failures are in the generated files, not the
flavor).
- Commit and push.
- The repository's own MegaLinter run fails on
actionlint, zizmor,
editorconfig-checker, markdownlint and checkov.
Expected behavior
The generated scaffolding passes MegaLinter out of the box, so a new custom
flavor repo starts green.
Additional context
mega-linter-runner@9.6.0, generator mega-linter-custom-flavor
- Verified with
actionlint (Docker rhysd/actionlint:latest), zizmor
v1.29.0, editorconfig-checker (Docker
mstruebing/editorconfig-checker:latest), and MegaLinter v9.6.0 in GitHub
Actions
- The repo where I hit this, with the fixes applied:
https://github.com/laywill/megalinter-custom-flavor-github-latex-markdown
Thanks for MegaLinter, and for the custom flavors feature in particular — the
image size saving is exactly what I needed.
Describe the bug
The files generated by
npx mega-linter-runner --custom-flavor-setupdon'tpass MegaLinter when the newly created flavor repository lints itself with the
standard
mega-linter.ymlworkflow. Since the generated repo is a MegaLinterrepo, the first CI run after following the Custom Flavors guide fails.
I hit this setting up a flavor for my own repos and fixed it locally. Happy to
open a PR against the generator templates if that's useful — I didn't want to
send one unprompted in case the strictness here is deliberate.
Findings, all from
generators/mega-linter-custom-flavor/templates/:check-new-megalinter-version.ymlandmegalinter-custom-flavor-builder.ymlACTION_ACTIONLINT(ShellCheckSC2086) — 16 findings from unquotedredirect targets, e.g.
echo "tag=$TAG" >> $GITHUB_OUTPUT. Fixed byquoting:
>> "$GITHUB_OUTPUT".ACTION_ACTIONLINT(ShellCheckSC2129) — theSummarystep's consecutive>> $GITHUB_STEP_SUMMARYwrites. Fixed by grouping them into one{ … } >> "$GITHUB_STEP_SUMMARY".ACTION_ZIZMOR(unpinned-uses, error) —actions/checkout@v6anddocker/login-action@v3aren't hash-pinned.oxsecurity/megalinter/flavors/custom-builder@mainis flagged too, but Iassume that one is deliberate, since the builder needs to track upstream; I
allowed it via an
unpinned-usespolicy in.github/zizmor.ymlrather thanpinning it. A line in the guide mentioning that exception would have saved
me some guessing.
ACTION_ZIZMOR(artipacked) — the builder's checkout step doesn't setpersist-credentials: false.EDITORCONFIG_EDITORCONFIG_CHECKER— trailing whitespace on 6 lines ofcheck-new-megalinter-version.yml, plus a 13-space continuation indent atlines 200-202 where
.editorconfigasks for a multiple of 2.REPOSITORY_CHECKOV(CKV_GHA_7) — "workflow_dispatch inputs MUST beempty". This one looks unavoidable, since
check-new-megalinter-version.ymldispatches the builder with
--field megalinter-version/--field is-latest. Might be worth a note in the docs that flavor reposneed to skip it.
README.mdMARKDOWN_MARKDOWNLINT(MD024) — the "How to use the custom flavor"section appears twice, once near the top and once at the bottom.
MARKDOWN_MARKDOWNLINT(MD034) — the repo URL on the "It is built fromofficial MegaLinter images…" line is a bare URL.
Three unrelated template bugs I noticed while fixing the above
check-new-megalinter-version.yml— the PAT setup instructions say "Choosethis repository (megalinter-custom-flavor-npm-groovy-lint)". Looks like a
leftover from the repo the template was written against; it appears
verbatim in every generated flavor.
check-new-megalinter-version.yml— theSummarystep setsGH_REPO: ${GITHUB_REPOSITORY}in itsenv:block. That isn't an Actionsexpression, so it's passed through as the literal string
${GITHUB_REPOSITORY}. The variable is unused in that step, so nothingbreaks today.
megalinter-custom-flavor-builder.yml— the header comment says the imagelands at
ghcr.io/<owner>/<repo>:<tag>, but the actual path isghcr.io/<owner>/<repo>/megalinter-custom-flavor:<tag>.To Reproduce
megalinter-custom-flavor,containing a normal
.github/workflows/mega-linter.ymlthat lints the repowith the official action.
npx mega-linter-runner@9.6.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,MARKDOWN_MARKDOWNLINT,YAML_YAMLLINT(any linter set works — the failures are in the generated files, not the
flavor).
actionlint,zizmor,editorconfig-checker,markdownlintandcheckov.Expected behavior
The generated scaffolding passes MegaLinter out of the box, so a new custom
flavor repo starts green.
Additional context
mega-linter-runner@9.6.0, generatormega-linter-custom-flavoractionlint(Dockerrhysd/actionlint:latest),zizmorv1.29.0,
editorconfig-checker(Dockermstruebing/editorconfig-checker:latest), and MegaLinter v9.6.0 in GitHubActions
https://github.com/laywill/megalinter-custom-flavor-github-latex-markdown
Thanks for MegaLinter, and for the custom flavors feature in particular — the
image size saving is exactly what I needed.