Giter Club home page Giter Club logo

curl's Introduction

GitHub Action for curl

Wraps the curl CLI to be used in GitHub Actions. See also GitHub Action for wget.

Features

  • make http requests
  • http errors are treated as errors

Usage

GitHub Actions

on: push
jobs:
  curl:
    runs-on: ubuntu-latest
    steps:
    - name: curl
      uses: wei/curl@master
      with:
        args: https://httpbin.org/get
on: push
jobs:
  curl:
    runs-on: ubuntu-latest
    steps:
    - name: curl
      uses: wei/curl@v1
      with:
        args: -X POST https://httpbin.org/post
on: push
jobs:
  curl:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: curl
      uses: wei/curl@v1
      with:
        args: --upload-file .github/workflows/main.yml https://transfer.sh/main-workflow.yml

Docker

docker run --rm $(docker build -q .) \
  https://httpbin.org/get

Author

Wei He [email protected]

License

MIT

curl's People

Contributors

wei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

curl's Issues

retry arguments are ignored

    - name: Verify with curl
      uses: wei/[email protected]
      with:
        args: http://localhost:5000/chat --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-max-time 40 -H "Content-Type:application/json" -d '{"message":"I am crazy"}'

I still get this error:

curl: (7) Failed to connect to localhost port 5000 after 0 ms: Connection refused

Add support for Windows ?

Hi, thank you for this nice Github Action.

Unfortunately it does not work on Windows.
It could function on Windows by using the preinstalled msys2's wget.exe executable at C:\msys64\usr\bin\wget.exe (not in PATH)

:)

Downloads are empty

I'm trying this code

- name: Download backup archives
  uses: wei/[email protected]
  with:
    args: ${{ secrets.ARCHIVE_BACKUP }} -O

Download an empty file
-rw-r--r-- 1 root root 0 Jul 14 15:13 archiveDocsBackup.tar.gz
So I don't know what I'm doing wrong.

Could not resolve host

Hi,

I'm executing your github action with this code:

    - name: send md5sum file to gitlab release
      uses: wei/curl@v1
      with:
        args: "-X POST \"https://gitlab.com/api/v4/projects/XXX/releases/A.B.C/assets/links\" -H \"Private-Token: ${{ secrets.GITLABTOKEN }}\" --data name=\"file1\" --data url=\"https://github.com/me/XXX/releases/download/A.B.C/file1\""

But when it runs:

/usr/bin/docker run --name blablabla --label blablabla --workdir /github/workspace --rm [...] blablabla -X POST "https://gitlab.com/api/v4/projects/XXX/releases/A.B.C/assets/links" -H "Private-Token: ***" --data name="file1" --data url="https://github.com/ME/gorkscrew/XXX/download/A.B.C/file1"
curl: (22) The requested URL returned error: 403 
curl: (6) Could not resolve host: ***

With another actions, i've installed packages from repositories and download files from internet, so there's no problem with internet access. Could you try to resolv gitlab.com domain inside your container? Could you guess what's happening?

Thanks and best regards

HTTP Error 406 does not fail the action

I have a POST action which by design returns HTTP 406, however the curl action does not seem to fail like advertised, but action workflow passes on. Are there any example of error handling of HTTP errors?

Looks like the action uses --silent --show-error --fail as fixed arguments, but still only url: (22) The requested URL returned error: 406 is printed to the console log, without any workflow error. Also tried checking the job status using if: ${{ job.status == 'failure' }}.

Get curl response and parse it

I want to create an action that will allow me to get timing info of a specific run.
I asked about that on GitHub community page and got a couple of endpoints I need to query.
I'd like to use your action, but I can't find any sample on how to save response and use it in other places.
My topic on the community: https://github.community/t5/GitHub-Actions/Get-timing-info-of-the-previous-job/m-p/45250

My question is: how can I store curl response to be able to use it in other steps of my job?

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.