From 7ae2fc118dc9249ef218fd92d7e0a187a9ca323c Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Mon, 23 Mar 2026 20:56:29 +0200 Subject: [PATCH 1/3] feat(bitbucket): Update generator template to match pull requests Related to #7410, #7412 Details: MegaLInter requires `BITBUCKET_PR_ID` env variable to exist. This variable is only available on a pull request triggered builds. Therefore update generator template to trigger builds on pull requests from any branch. Ref: https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/ (look up `BITBUCKET_PR_ID` variable) --- .../templates/bitbucket-pipelines.yml | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/mega-linter-runner/generators/mega-linter/templates/bitbucket-pipelines.yml b/mega-linter-runner/generators/mega-linter/templates/bitbucket-pipelines.yml index fcddf0368f8..b25c9f3a17c 100644 --- a/mega-linter-runner/generators/mega-linter/templates/bitbucket-pipelines.yml +++ b/mega-linter-runner/generators/mega-linter/templates/bitbucket-pipelines.yml @@ -4,22 +4,23 @@ image: atlassian/default-image:5 pipelines: - default: - - parallel: - - step: - name: Run MegaLinter - image: <%= DOCKER_IMAGE_NAME %>:<%= DOCKER_IMAGE_VERSION %> - script: - # Disable LLM Advisor for bot PRs (dependabot, renovate, etc.) - # Note: Bitbucket has limited access to PR metadata, this is a basic check - - | - if [[ "$BITBUCKET_BRANCH" =~ ^(dependabot|renovate)/ ]] || - [[ "$BITBUCKET_PR_TITLE" =~ ^(chore|fix|deps?|bump)(\(.*\))?: ]] || - [[ "$BITBUCKET_STEP_TRIGGERER_UUID" =~ dependabot|renovate ]]; then - export LLM_ADVISOR_ENABLED=false - else - export LLM_ADVISOR_ENABLED=true - fi - - export DEFAULT_WORKSPACE=$BITBUCKET_CLONE_DIR && bash /entrypoint.sh - artifacts: - - megalinter-reports/** + pull-requests: # Note: MegaLinter can post comments to pull requests only + "**": # Run on PRs for any branch (the source branch of the pull request) + - parallel: + - step: + name: Run MegaLinter + image: <%= DOCKER_IMAGE_NAME %>:<%= DOCKER_IMAGE_VERSION %> + script: + # Disable LLM Advisor for bot PRs (dependabot, renovate, etc.) + # Note: Bitbucket has limited access to PR metadata, this is a basic check + - | + if [[ "$BITBUCKET_BRANCH" =~ ^(dependabot|renovate)/ ]] || + [[ "$BITBUCKET_PR_TITLE" =~ ^(chore|fix|deps?|bump)(\(.*\))?: ]] || + [[ "$BITBUCKET_STEP_TRIGGERER_UUID" =~ dependabot|renovate ]]; then + export LLM_ADVISOR_ENABLED=false + else + export LLM_ADVISOR_ENABLED=true + fi + - export DEFAULT_WORKSPACE=$BITBUCKET_CLONE_DIR && bash /entrypoint.sh + artifacts: + - megalinter-reports/** From 23946b0fa85eabe9005a14f550475e54334c2601 Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Mon, 23 Mar 2026 21:05:25 +0200 Subject: [PATCH 2/3] Add CHANGELOG entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c9f8909a7c..c168e7e9077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l - Fixes - Reporters + - Update Bitbucket pipeline generator template to trigger builds on pull requests from any branch, by @yermulnik in - Flavors From 3707c50a6d0d4399c8f1b4ffafcf37a16836bd58 Mon Sep 17 00:00:00 2001 From: "George L. Yermulnik" Date: Mon, 23 Mar 2026 21:10:04 +0200 Subject: [PATCH 3/3] Address GH Copilot suggestion --- .../generators/mega-linter/templates/bitbucket-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mega-linter-runner/generators/mega-linter/templates/bitbucket-pipelines.yml b/mega-linter-runner/generators/mega-linter/templates/bitbucket-pipelines.yml index b25c9f3a17c..9739cb59e10 100644 --- a/mega-linter-runner/generators/mega-linter/templates/bitbucket-pipelines.yml +++ b/mega-linter-runner/generators/mega-linter/templates/bitbucket-pipelines.yml @@ -4,7 +4,7 @@ image: atlassian/default-image:5 pipelines: - pull-requests: # Note: MegaLinter can post comments to pull requests only + pull-requests: # Note: Bitbucket PR comment reporting requires pull request context "**": # Run on PRs for any branch (the source branch of the pull request) - parallel: - step: