Created
September 30, 2020 07:31
-
-
Save int128/b0e75e3043c8a33808cea0089d988ed3 to your computer and use it in GitHub Desktop.
Get files in a repository using GitHub GraphQL
This file contains hidden or 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
query { | |
repository(owner: "int128", name: "kubelogin") { | |
defaultBranchRef { | |
target { | |
... on Commit { | |
file(path: "/.github/workflows") { | |
type | |
object { | |
... on Tree { | |
entries { | |
name | |
object { | |
... on Blob { | |
text | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains hidden or 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
{ | |
"data": { | |
"repository": { | |
"defaultBranchRef": { | |
"target": { | |
"file": { | |
"type": "tree", | |
"object": { | |
"entries": [ | |
{ | |
"name": "golangci-lint.yaml", | |
"object": { | |
"text": "on:\n push:\n paths:\n - .github/workflows/golangci-lint.yaml\n - '**.go'\njobs:\n golangci:\n name: lint\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v2\n - uses: golangci/golangci-lint-action@v2\n with:\n version: v1.30\n" | |
} | |
}, | |
{ | |
"name": "system-test.yaml", | |
"object": { | |
"text": "on:\n push:\n paths: \n - .github/workflows/system-test.yaml\n - system_test/**\n - pkg/**\n - go.*\njobs:\n system-test:\n # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/software-installed-on-github-hosted-runners#ubuntu-1804-lts\n runs-on: ubuntu-18.04\n steps:\n - uses: actions/setup-go@v2\n with:\n go-version: 1.15\n id: go\n - uses: actions/checkout@v2\n - uses: actions/cache@v2\n with:\n path: ~/go/pkg/mod\n key: go-${{ hashFiles('**/go.sum') }}\n restore-keys: |\n go-\n # https://packages.ubuntu.com/xenial/libnss3-tools\n - run: sudo apt update\n - run: sudo apt install -y libnss3-tools\n - run: mkdir -p ~/.pki/nssdb\n - run: echo '127.0.0.1 dex-server' | sudo tee -a /etc/hosts\n - run: make -C system_test -j3\n" | |
} | |
} | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for this!
Although, I'd recommend specifying that this query searches for files within the folder
.github/workflows
and if you'd just want to search for files in the root folder of the repo, then you'd use"/"
as thepath