Skip to content

Instantly share code, notes, and snippets.

View richkuz's full-sized avatar

Rich Kuzsma richkuz

View GitHub Profile
@richkuz
richkuz / GitHub Graph QL APIs.md
Created January 27, 2023 17:15
GitHub API Graph QL scratch pad

This is my scratch pad of GitHub graph QL queries I run with the Graphiql app.

Make sure to "Edit HTTP Headers" in Graphiql and set the header with your GitHub Personal Dev API Token: Authorization Bearer ghp_ubRfl1F4...

query FindRepo {
  repository(owner: "richkuz", name: "repo2") {
    id
  }
@richkuz
richkuz / how-to-run-github-graphql-api.md
Created October 14, 2022 20:57
How to run a GitHub GraphQL API in GraphiQL

An easy way to run a GitHub GraphQL API call is to use the GraphiQL app:

brew install --cask graphiql

Run GraphiQL and click "Edit Headers". Add a header with the name Authorization and value Bearer ghp_REPLACEME where ghp_REPLACEME is the value of a GitHub Access Token. You can create a GitHub Access Token under https://github.com/settings/tokens.

Then type a GraphQL query and run it.

@richkuz
richkuz / how-to-find-a-github-label-id.md
Last active October 14, 2022 20:58
How to find a GitHub label ID

To find a GitHub label ID, such as for use in a labelIds parameter when creating an issue with the createIssue API, run this graphql API:

query FindLabelId {
  repository(owner: "richkuz", name: "repo1") {
    label(name:"bug") {
      id
    }
  }
}
@richkuz
richkuz / script.groovy
Created September 30, 2022 21:45
Groovy script to fetch Okta SAML identity from GitHub using GraphQL
def message = """{
"query": "query {
organization(login: \\"elastic\\") {
samlIdentityProvider {
externalIdentities(first: 100) {
pageInfo {
endCursor
hasNextPage
}
edges {
@richkuz
richkuz / github-projectv2-projectnext-notes.md
Created August 7, 2022 13:56
Notes about using the new GitHub ProjectV2 API

Notes on GitHub ProjectV2 API

GitHub Projects Beta aka GitHub Projects Next aka GitHub ProjectNext is now known as GitHub ProjectV2 in the API.

It's not immediately obvious how to use the new API, especially if you're coming from the old beta API.

You no longer need to set the HTTP header: GraphQL-Features: projects_next_graphql.

You still need to add your GitHub personal access token to the Authorization header, e.g. Authorization: Basic ghp_...

@richkuz
richkuz / enterprise_search_config_api.js
Created July 7, 2022 00:36
enterprise_search_config_api.js hacked up 8.3.2
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.warnMismatchedVersions = exports.callEnterpriseSearchConfigAPI = void 0;
var _abortController = _interopRequireDefault(require("abort-controller"));
@richkuz
richkuz / enterprise_search_request_handler.ts
Last active July 6, 2022 23:00
enterprise_search_request_handler.ts 8.3.2 hacked up
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.EnterpriseSearchRequestHandler = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
@richkuz
richkuz / 1-use-custom-plugins-and-jenkins-with-jenkinsfile-runner.md
Created May 25, 2022 13:04
How to use custom plugins and specify Jenkins version in Jenkinsfile-runner image

Install custom plugins and custom Jenkins version in Jenkinsfile-runner (JFR)

To specify your own set of plugins and use a specific version of Jenkins with Jenkinsfile-runner, build a modified Jenkinsfile-runner image that overrides the plugins and installs a specific Jenkins into it.

Use the attached Dockerfile and plugins.txt to build your own Jenkinsfile-runner image.

In plugins.txt, it's a best practice to pin your plugins to specific versions, e.g.

git-server:1.11
@richkuz
richkuz / app-search-8.2.0-engine-analyzers.json
Created May 23, 2022 17:33
Analyzers found in the index for an App Search 8.2.0 sample data engine
"analysis" : {
"filter" : {
"front_ngram" : {
"type" : "edge_ngram",
"min_gram" : "1",
"max_gram" : "12"
},
"bigram_joiner" : {
"max_shingle_size" : "2",
"token_separator" : "",
@richkuz
richkuz / app-search-8.2.0-engine-mapping.json
Created May 23, 2022 17:31
Index mapping for App Search 8.2.0 sample engine
{
".ent-search-engine-documents-sample" : {
"mappings" : {
"dynamic" : "true",
"dynamic_templates" : [
{
"permissions" : {
"match" : "_*_permissions",
"mapping" : {
"type" : "keyword"