Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sketch-hq/gql-lint
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.1.1
Choose a base ref
...
head repository: sketch-hq/gql-lint
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.1.2
Choose a head ref
  • 6 commits
  • 5 files changed
  • 3 contributors

Commits on Feb 23, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    1ed562b View commit details
  2. Copy the full SHA
    a7d8ff2 View commit details
  3. Copy the full SHA
    4c44c59 View commit details

Commits on Oct 18, 2024

  1. Copy the full SHA
    33dedde View commit details
  2. Bump github.com/vektah/gqlparser/v2 from 2.5.1 to 2.5.15 (#45)

    Bumps [github.com/vektah/gqlparser/v2](https://github.com/vektah/gqlparser) from 2.5.1 to 2.5.15.
    - [Release notes](https://github.com/vektah/gqlparser/releases)
    - [Commits](vektah/gqlparser@v2.5.1...v2.5.15)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/vektah/gqlparser/v2
      dependency-type: direct:production
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Oct 18, 2024
    Copy the full SHA
    1642d73 View commit details
  3. Copy the full SHA
    11c42a2 View commit details
Showing with 104 additions and 58 deletions.
  1. +69 −0 .github/workflows/gql_deprecated_fields_report.yml
  2. +27 −34 .github/workflows/gql_new_deprecated_fields.yml
  3. +3 −4 .github/workflows/release.yml
  4. +1 −1 go.mod
  5. +4 −19 go.sum
69 changes: 69 additions & 0 deletions .github/workflows/gql_deprecated_fields_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This workflow will build a report with the used deprecated GQL fields
# Parent workflow must pass the secrets: inherit option
# See example: on-pr-example.yml
name: Deprecated fields report

on:
workflow_call:
inputs:
schema_urls:
description: "Schema URLs to lint, comma separated. E.g: https://one.com/api/graphql,https://two.com/clients/graphql"
required: true
type: string
default: ""
query_files:
description: "Paths of query files to lint. E.g: queries/**/*.graphql api/**/*.gql"
required: true
type: string
default: ""
ignore_files:
description: "Paths of files to ignore, comma separated. E.g: .graphql/**/local.*.gql,other/path/**/*.graphql"
required: false
type: string
default: ""

jobs:
reportUsedDeprecatedFields:
name: Report used deprecated fields
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- uses: actions/checkout@v3

# Install gql-lint
- name: Install gql-lint
run: curl https://raw.githubusercontent.com/sketch-hq/gql-lint/main/install.sh | /bin/bash -s -- latest
shell: bash

# Install jo
- name: Install jo
run: sudo apt-get install jo
shell: bash

- name: Find all deprecated fields
shell: bash
id: report
run: |
gql-lint deprecation \
--schema "${{ inputs.schema_urls }}" \
--ignore "${{ inputs.ignore_files }}" \
"${{ inputs.query_files }}" \
> results.txt
- name: Serialize results
shell: bash
run: |
jo \
report="$(cat results.txt)" \
> results.json
- name: Post to Slack
id: slack
uses: slackapi/slack-github-action@v1.23.0
with:
payload-file-path: "./results.json"
env:
SLACK_WEBHOOK_URL: ${{ secrets.DEPRECATED_FIELDS_REPORT_URL }}
61 changes: 27 additions & 34 deletions .github/workflows/gql_new_deprecated_fields.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ on:
type: string
default: ""
query_files:
description: "Paths of query files to lint, comma separated. E.g: queries/**/*.graphql,api/**/*.gql"
description: "Paths of query files to lint, E.g: queries/**/*.graphql api/**/*.gql"
required: true
type: string
default: ""
@@ -46,39 +46,14 @@ jobs:
# Checkout the pr's branch
- uses: actions/checkout@v3

- name: Generate gql-lint files command segment
id: gql-lint-command-segment
run: |
set -f # disable globbing
OUTPUT="" # initialize output variable
mapfile -d ',' -t queries < <(printf '%s,' '${{ inputs.query_files }}')
for query in "${queries[@]}"; do
OUTPUT+="\"$query\" "
done
echo files=$OUTPUT >> $GITHUB_OUTPUT
set +f
# For now, we always run the deprecation check on the PR branch, even if no qgl were changed, to have the full list of deprecated fields in the logs
- name: Find deprecated queries used in the PR branch
run: |
gql-lint deprecation --output json --schema "${{ inputs.schema_urls }}" --ignore "${{ inputs.ignore_files }}" ${{ steps.gql-lint-command-segment.outputs.files }} > /tmp/pr.json
gql-lint deprecation --output json --schema "${{ inputs.schema_urls }}" --ignore "${{ inputs.ignore_files }}" ${{ inputs.query_files }} > /tmp/pr.json
cat /tmp/pr.json | jq .
# Checkout branch we're planning to merge into
- uses: actions/checkout@v3
with:
ref: "${{ inputs.base_branch }}"

- name: Find deprecated queries used in the base branch
run: gql-lint deprecation --output json --schema "${{ inputs.schema_urls }}" --ignore "${{ inputs.ignore_files }}" ${{ steps.gql-lint-command-segment.outputs.files }} > /tmp/base.json

- name: Diff to find any new deprecated fields introduced by PR branch
id: diff-fields
run: |
echo 'DIFF<<EOF' >> $GITHUB_OUTPUT
gql-lint diff /tmp/base.json /tmp/pr.json >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
#Annotate the PR with findings just for modified files
# Annotate the PR with findings just for modified files
# From here below, steps only run if there are modified files
- name: Get changed files
id: changed-files
uses: Ana06/get-changed-files@v2.2.0
@@ -91,9 +66,27 @@ jobs:
- name: Generate annotations JSON
if: steps.changed-files.outputs.added_modified != ''
run: |
gql-lint deprecation --output annotate --include="${{ steps.changed-files.outputs.added_modified }}" --schema "${{ inputs.schema_urls }}" --ignore "${{ inputs.ignore_files }}" ${{ steps.gql-lint-command-segment.outputs.files }} > /tmp/annotations.json
gql-lint deprecation --output annotate --include="${{ steps.changed-files.outputs.added_modified }}" --schema "${{ inputs.schema_urls }}" --ignore "${{ inputs.ignore_files }}" ${{ inputs.query_files }} > /tmp/annotations.json
cat /tmp/annotations.json | jq .
# Checkout branch we're planning to merge into
- uses: actions/checkout@v3
if: steps.changed-files.outputs.added_modified != ''
with:
ref: "${{ inputs.base_branch }}"

- name: Find deprecated queries used in the base branch
if: steps.changed-files.outputs.added_modified != ''
run: gql-lint deprecation --output json --schema "${{ inputs.schema_urls }}" --ignore "${{ inputs.ignore_files }}" ${{ inputs.query_files }} > /tmp/base.json

- name: Diff to find any new deprecated fields introduced by PR branch
if: steps.changed-files.outputs.added_modified != ''
id: diff-fields
run: |
echo 'DIFF<<EOF' >> $GITHUB_OUTPUT
gql-lint diff /tmp/base.json /tmp/pr.json >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: Annotate files
if: steps.changed-files.outputs.added_modified != ''
uses: yuzutech/annotations-action@v0.4.0
@@ -124,11 +117,11 @@ jobs:
# install gql-lint if you haven't already
curl ${{ env.GQL_LINT_INSTALLER }} | /bin/bash -s -- latest
gql-lint deprecation --schema "${{ inputs.schema_urls }}" --ignore "${{ inputs.ignore_files }}" ${{ steps.gql-lint-command-segment.outputs.files }}
gql-lint deprecation --schema "${{ inputs.schema_urls }}" --ignore "${{ inputs.ignore_files }}" ${{ inputs.query_files }}
```
Files checked:
`${{ steps.gql-lint-command-segment.outputs.files }}`
`${{ inputs.query_files }}`
- name: Fail if new deprecated fields are found
if: steps.changed-files.outputs.added_modified != '' && steps.diff-fields.outputs.DIFF != ''
run: echo "Failing workflow because new deprecated fields were found" && exit 1
run: echo "Failing workflow because new deprecated fields were found" && exit 1
7 changes: 3 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ jobs:
goos: darwin
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1.34
- uses: wangyoucao577/go-release-action@v1.52
with:
project_path: "./cmd"
github_token: ${{ secrets.GITHUB_TOKEN }}
@@ -27,10 +27,10 @@ jobs:
asset_name: "gql-lint-${{ matrix.goos }}-${{ matrix.goarch }}"
ldflags: "-s -w -X main.version=${{ github.ref_name }}"
binary_name: "gql-lint"

lipo:
name: Universal Mac binary
runs-on: macos-12
runs-on: macos-15
needs: releases-matrix
env:
ARM_FILE: "gql-lint-darwin-arm64.tar.gz"
@@ -92,4 +92,3 @@ jobs:
asset_path: "./${{ env.UNIVERSAL_FILE }}.md5"
asset_name: "${{ env.UNIVERSAL_FILE }}.md5"
asset_content_type: application/text

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ require (
github.com/google/go-cmdtest v0.4.0
github.com/matryer/is v1.4.0
github.com/spf13/cobra v1.6.1
github.com/vektah/gqlparser/v2 v2.5.1
github.com/vektah/gqlparser/v2 v2.5.15
github.com/wundergraph/graphql-go-tools v1.61.2
)

23 changes: 4 additions & 19 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/agnivade/levenshtein v1.1.1 h1:QY8M92nrzkmr798gCo3kmMyqXFzdQVpxLlGPRBij0P8=
github.com/agnivade/levenshtein v1.1.1/go.mod h1:veldBMzWxcCG2ZvUTKD2kJNRdCk5hVbJomOvKkmgYbo=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883 h1:bvNMNQO63//z+xNgfBlViaCIJKLlCJ6/fmUseuG0wVQ=
github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q=
github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48 h1:fRzb/w+pyskVMQ+UbP35JkH8yB7MYb4q/qhBarqZE6g=
github.com/dgryski/trifles v0.0.0-20200323201526-dd97f9abfb48/go.mod h1:if7Fbed8SFyPtHLHbg49SI7NAdJiC5WIA09pe59rfAA=
github.com/google/go-cmdtest v0.4.0 h1:ToXh6W5spLp3npJV92tk6d5hIpUPYEzHLkD+rncbyhI=
@@ -24,24 +20,17 @@ github.com/google/renameio v1.0.1/go.mod h1:t/HQoYBZSsWSNK35C6CO/TpPLDVWvxOHboWU
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jensneuse/diffview v1.0.0 h1:4b6FQJ7y3295JUHU3tRko6euyEboL825ZsXeZZM47Z4=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sebdah/goldie/v2 v2.5.3 h1:9ES/mNN+HNUbNWpVAlrzuZ7jE+Nrczbj8uFRjM7624Y=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/tidwall/gjson v1.11.0 h1:C16pk7tQNiH6VlCrtIXL1w8GaOsi1X3W8KDkE1BuYd4=
github.com/tidwall/gjson v1.11.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
@@ -50,15 +39,11 @@ github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
github.com/tidwall/sjson v1.0.4 h1:UcdIRXff12Lpnu3OLtZvnc03g4vH2suXDXhBwBqmzYg=
github.com/tidwall/sjson v1.0.4/go.mod h1:bURseu1nuBkFpIES5cz6zBtjmYeOQmEESshn7VpF15Y=
github.com/vektah/gqlparser/v2 v2.5.1 h1:ZGu+bquAY23jsxDRcYpWjttRZrUz07LbiY77gUOHcr4=
github.com/vektah/gqlparser/v2 v2.5.1/go.mod h1:mPgqFBu/woKTVYWyNk8cO3kh4S/f4aRFZrvOnp3hmCs=
github.com/vektah/gqlparser/v2 v2.5.15 h1:fYdnU8roQniJziV5TDiFPm/Ff7pE8xbVSOJqbsdl88A=
github.com/vektah/gqlparser/v2 v2.5.15/go.mod h1:WQQjFc+I1YIzoPvZBhUQX7waZgg3pMLi0r8KymvAE2w=
github.com/wundergraph/graphql-go-tools v1.61.2 h1:zO6bveWwPf7IVYJqbUffsW9sbWhhWuRTPAIjFju2xlA=
github.com/wundergraph/graphql-go-tools v1.61.2/go.mod h1:Lsg/b4nVfNQLyJE1mjPV73O/JuhhCxH5qmaWQjitVHM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=