Code Monkey home page Code Monkey logo

watermelon-http-client's Introduction

๐Ÿ‰ Watermelon HTTP client - GitHub Action

A Typescript Action that performs HTTP requests within your workflow. It supports GraphQL!

Build

Inputs

Argument Description Default
url Endpoint to query https://api.github.com. If graphql is set, then https://api.github.com/graphql
method HTTP method GET
headers JSON encoded HTTP headers Empty by default. If no headers are supplied, GraphQL queries will be sent with {'Content-Type': 'application/json'}
data JSON encoded HTTP request payload
graphql GraphQL query/mutation to execute Empty by default. If defined, the data field is automatically populated with this payload and the method is set to POST
variables JSON encoded variables for the GraphQL mutation
operation_name name of the entrypoint GraphQL operation if multiple are defined in graphql
fail_fast wether to fail upon HTTP error responses (e.g. 400, 500) false
verbose wether to print info-level statements or not false

Outputs

Name Description
status Numeric response status code
headers JSON encoded response HTTP headers
response JSON encoded response

Examples

Complete workflow file examples for the majority of supported HTTP requests can be found in .github/workflows.

GET

workflow file - sample output

uses: CamiloGarciaLaRotta/watermelon-http-client@v1
with:
  url: 'https://jsonplaceholder.typicode.com/todos?id=1'

POST

workflow file - sample output

uses: CamiloGarciaLaRotta/watermelon-http-client@v1
with:
  url: 'https://jsonplaceholder.typicode.com/todos'
  method: post
  data: '{ "title": "dummy-todo", "userId": 1, "completed": false }'

GraphQL Query

workflow file - sample output

uses: CamiloGarciaLaRotta/watermelon-http-client@v1
with:
url: 'https://countries.trevorblades.com/'
  graphql: |
    {
      country(code: "CO") {
        name
        emoji
      }
    }

GraphQL Mutation

workflow file - sample output

uses: CamiloGarciaLaRotta/watermelon-http-client@v1
with:
  headers: '{"Authorization": "bearer ${{ secrets.TOKEN }}", "Content-Type": "application/json" }'
  graphql: |
    mutation addRocketEmoji($reaction:AddReactionInput!) {
      addReaction(input:$reaction) {
        reaction {
          content
        }
        subject {
          id
        }
      }
    }
  variables: |
    {
      "reaction": {
        "subjectId":"${{ secrets.ISSUE_ID }}",
        "content":"ROCKET"
      }
    }

Contributing

See the contribution guidelines โค๏ธ

watermelon-http-client's People

Contributors

camilogarcialarotta avatar dependabot-preview[bot] avatar dependabot[bot] avatar titoine54 avatar rramo012 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.