diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 3496f135..8c9d9e46 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -106,6 +106,31 @@ jobs: overwrite: true file_glob: true + - name: Check if GraphQL Schema Changed + if: matrix.os == 'linux' && matrix.arch == 'amd64' + id: changed-files-specific + uses: tj-actions/changed-files@v29 + with: + files: | + pkg/extensions/search/schema.graphql + + - name: Generate GraphQL Introspection JSON + if: steps.changed-files-specific.outputs.any_changed == 'true' && matrix.os == 'linux' && matrix.arch == 'amd64' + run: | + echo "Schema has changed" + bin/zot-linux-amd64 serve examples/config-search.json & + sleep 10 + mkdir introspection + curl -X POST -H "Content-Type: application/json" -d @.pkg/debug/githubWorkflows/introspection-query.json http://localhost:5000/v2/_zot/ext/search | jq > introspection/introspection-result.json + pkill zot + + - name: Upload GraphQL Introspection JSON + uses: actions/upload-artifact@v3 + if: steps.changed-files-specific.outputs.any_changed == 'true' && matrix.os == 'linux' && matrix.arch == 'amd64' + with: + name: introspection-result + path: introspection/introspection-result.json + push-image: if: github.event_name == 'release' && github.event.action== 'published' name: Push OCI images to GitHub Packages diff --git a/pkg/debug/githubWorkflows/introspection-query.json b/pkg/debug/githubWorkflows/introspection-query.json new file mode 100644 index 00000000..32b2bd7a --- /dev/null +++ b/pkg/debug/githubWorkflows/introspection-query.json @@ -0,0 +1 @@ +{"query": "{__schema{queryType{name}mutationType{name}subscriptionType{name}types{...FullType}directives{name description locations args{...InputValue}}}}fragment FullType on __Type{kind name description fields(includeDeprecated:true){name description args{...InputValue}type{...TypeRef}isDeprecated deprecationReason}inputFields{...InputValue}interfaces{...TypeRef}enumValues(includeDeprecated:true){name description isDeprecated deprecationReason}possibleTypes{...TypeRef}}fragment InputValue on __InputValue{name description type{...TypeRef}defaultValue}fragment TypeRef on __Type{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name ofType{kind name}}}}}}}}"}