Skip to content

Commit 3efbff3

Browse files
Fix issue with EXTENDS using private repository by sending GITHUB_TOKEN as HTTP auth header (#3404)
* Fix issue with EXTENDS using private repository by sending GITHUB_TOKEN as HTTP auth header Co-authored-by: Bheem <[email protected]> * [MegaLinter] Apply linters fixes --------- Co-authored-by: nvuillam <[email protected]> Co-authored-by: Bheem <[email protected]> Co-authored-by: nvuillam <[email protected]>
1 parent dafb4df commit 3efbff3

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
1818
- Trivy: use `misconfig` instead of the deprecated `config` scanner, updating the default arguments
1919
- Update calls to sfdx-scanner to output a CSV file for Aura & LWC
2020
- Kics: fixed error count in the summary table
21+
- Fix issue with EXTENDS using private repository by sending GITHUB_TOKEN as HTTP auth header
2122
- Fix SPELL_VALE_CONFIG_FILE not working (handle the override of linter CONFIG_FILE if the linter is activated only if some files are found)
2223

2324
- Doc

megalinter/config.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,14 @@ def combine_config(workspace, config, combined_config, config_source):
109109
extends = extends.split(",")
110110
for extends_item in extends:
111111
if extends_item.startswith("http"):
112-
r = requests.get(extends_item, allow_redirects=True)
112+
headers = {}
113+
if (
114+
extends_item.startswith("https://raw.githubusercontent.com")
115+
and "GITHUB_TOKEN" in os.environ
116+
):
117+
github_token = os.environ["GITHUB_TOKEN"]
118+
headers["Authorization"] = f"token {github_token}"
119+
r = requests.get(extends_item, allow_redirects=True, headers=headers)
113120
assert (
114121
r.status_code == 200
115122
), f"Unable to retrieve EXTENDS config file {extends_item}"

0 commit comments

Comments
 (0)