Skip to content

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 04 Oct 22:11
· 17 commits to main since this release
7edaf9e
uses: github.com/linyows/probe-graphql@f9e7b841b87dccbcbe71ae10f8562aa637d52a51 # v0.1.0

Highlights

  • The first release: a Probe action that sends a GraphQL query or mutation over HTTP, and returns the data and errors of the response apart.
  • It is an external action, the first one, for Probe v1.17.0 or later.
  • The repository has since moved to mozership/probe-graphql. v0.1.1 is the same action, released from there.

Sending a query

- name: Look up Japan
  uses: github.com/linyows/probe-graphql@f9e7b841b87dccbcbe71ae10f8562aa637d52a51 # v0.1.0
  with:
    url: https://countries.trevorblades.com/graphql
    query: |
      query Country($code: ID!) {
        country(code: $code) { name capital currency }
      }
    variables:
      code: JP
  test: res.code == 200 && len(res.errors) == 0 && res.data.country.capital == "Tokyo"
  • with takes url, query, variables, operation_name, headers and timeout (default 30s). The request is a POST with a JSON body.
  • res.data and res.errors hold the data and errors of the response, and res.body the whole body. status is 0 when the status code is 2xx, the body is JSON and errors is empty.
  • Any response the server sends is a result, so a test can assert on a GraphQL error or a 500. Only a request that gets no response fails the step as an error.
  • The action keeps to no guard: under --read-only or --allow-host, a step that uses it is refused unless --allow-action names it.

Releasing

A v* tag builds the executables with GoReleaser, and the release workflow commits an action.yml with their URLs and SHA-256 digests. That commit, in the uses line above, is the one to pin.

Changelog

  • 7edaf9e Send a GraphQL query from a Probe workflow