mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge branch 'main' into redsun82/go-make
This commit is contained in:
2
.github/workflows/buildifier.yml
vendored
2
.github/workflows/buildifier.yml
vendored
@@ -24,5 +24,5 @@ jobs:
|
||||
extra_args: >
|
||||
buildifier --all-files 2>&1 ||
|
||||
(
|
||||
echo -e "In order to format all bazel files, please run:\n bazel run //:buildifier"; exit 1
|
||||
echo -e "In order to format all bazel files, please run:\n bazel run //misc/bazel:buildifier"; exit 1
|
||||
)
|
||||
|
||||
@@ -26,7 +26,7 @@ repos:
|
||||
name: Format bazel files
|
||||
files: \.(bazel|bzl)
|
||||
language: system
|
||||
entry: bazel run //:buildifier
|
||||
entry: bazel run //misc/bazel:buildifier
|
||||
pass_filenames: false
|
||||
|
||||
- id: go-gen
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
|
||||
|
||||
buildifier(
|
||||
name = "buildifier",
|
||||
exclude_patterns = [
|
||||
"./.git/*",
|
||||
],
|
||||
lint_mode = "fix",
|
||||
)
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
|
||||
|
||||
buildifier(
|
||||
name = "buildifier",
|
||||
exclude_patterns = [
|
||||
"./.git/*",
|
||||
],
|
||||
lint_mode = "fix",
|
||||
)
|
||||
|
||||
@@ -82,18 +82,22 @@ def get_endpoint():
|
||||
|
||||
# see https://github.com/git-lfs/git-lfs/blob/310d1b4a7d01e8d9d884447df4635c7a9c7642c2/docs/api/basic-transfers.md
|
||||
def get_locations(objects):
|
||||
ret = ["local" for _ in objects]
|
||||
endpoint = get_endpoint()
|
||||
indexes = [i for i, o in enumerate(objects) if o]
|
||||
ret = ["local" for _ in objects]
|
||||
if not indexes:
|
||||
# all objects are local, do not send an empty request as that would be an error
|
||||
return ret
|
||||
data = {
|
||||
"operation": "download",
|
||||
"transfers": ["basic"],
|
||||
"objects": [objects[i] for i in indexes],
|
||||
"hash_algo": "sha256",
|
||||
}
|
||||
req = urllib.request.Request(
|
||||
f"{endpoint.href}/objects/batch",
|
||||
headers=endpoint.headers,
|
||||
data=json.dumps({
|
||||
"operation": "download",
|
||||
"transfers": ["basic"],
|
||||
"objects": [o for o in objects if o],
|
||||
"hash_algo": "sha256",
|
||||
}).encode("ascii"),
|
||||
data=json.dumps(data).encode("ascii"),
|
||||
)
|
||||
with urllib.request.urlopen(req) as resp:
|
||||
data = json.load(resp)
|
||||
|
||||
Reference in New Issue
Block a user