-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow for overridden companion refs through --companion-overrides
- Loading branch information
1 parent
431c0fc
commit 794e4a4
Showing
2 changed files
with
238 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
ghgql_latest_repositories_refs_query() { | ||
unset out | ||
|
||
local org="$1" | ||
local repo="$2" | ||
local refs_query="$3" | ||
|
||
echo " | ||
query { | ||
repository(owner: \"$org\", name: \"$repo\") { | ||
refs( | ||
refPrefix: \"refs/heads/\", | ||
first: 32, | ||
query: \"$refs_query\", | ||
orderBy: { field: TAG_COMMIT_DATE, direction: DESC } | ||
) { | ||
edges { | ||
node { | ||
name | ||
} | ||
} | ||
} | ||
} | ||
} | ||
" | ||
} | ||
|
||
ghgql_post() { | ||
local github_graphql_api="$1" | ||
local github_api_token="$2" | ||
local query="$3" | ||
|
||
local req_body | ||
req_body="{ \"query\": \"$(echo "$query" | tr -d '\n' | sed 's/"/\\"/g')\" }" | ||
|
||
>&2 echo " | ||
Sending GraphQL body to $github_graphql_api | ||
Raw query: $query | ||
JSON body: $req_body | ||
" | ||
|
||
curl \ | ||
-sSL \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: bearer $github_api_token" \ | ||
-X POST \ | ||
-d "$req_body" \ | ||
"$github_graphql_api" | ||
} |