swinton / httpie.action

:zap: Human-friendly interactions with third-party web services through GitHub Actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update documentation to use the new syntax

tristanbes opened this issue · comments

Hello,

Right now in your doc, all examples uses the old github syntax that no longer exists since it went into GA.

Is that possible to update your examples with the newer syntax ? I'd love to use your HTTPie wrapper;

Thanks @tristanbes. You might not need to use this action any more, as I believe HTTPie is now "baked in" to the Actions run-time environment, e.g. you should be able to just do this:

name: HTTPie Demo

on:
  push:
    branches:         # array of glob patterns matching against refs/heads. Optional; defaults to all
    - master          # triggers on pushes that contain changes in master

jobs:
  httpie-demo:
    name: HTTPie Demo
    runs-on: ubuntu-latest
    steps:
    - run: |
        http get https://api.github.com/ --body

Let me know if this doesn't work for you, if so I'll look at dusting off this old action 🙇

Hey @swinton it seems that they are not shipping HTTPie in the default container

/home/runner/work/_temp/37261e0a-a6c0-419c-b3de-cc3465eb233f.sh: line 1: http: command not found
##[error]Process completed with exit code 127.

Yep, you're right, verified here.

The way this could work in the new "Actions v2" world is:

  • A new action, e.g. swinton/setup-httpie
  • This would install HTTPie into the run-time environment
  • Optionally, the setup would include some configuration / installation of additional plugins
  • It might be necessary to install a wrapper around HTTPie so that HTTP responses can be captured as outputs
  • Downstream steps in a workflow would be able to run the http CLI and consume the output

@tristanbes does that sound usable to you?

I have no idea :D. I went with:

- name: Install HTTPie
  run: sudo apt-get install httpie

- name: Ask to our Ansible Tower instance to deploy our app
  run: >
    http post ${{ env.TOWER_INSTANCE_DOMAIN }}/api/v2/job_templates/26/launch/
    'Authorization:Bearer ${{ secrets.TOWER_OAUTH2_TOKEN }}' -j
    <<<'{"extra_vars": "{\"yprox_version\": ${{ github.sha
    }},\"no_interaction\": true}"}'

because my main use is just do a POST request without the need to use the curl syntax.

So I guess your action could benefit users that do advanced stuff with httpie like you mentionned (plugins...) but for me, for now, that manual install does the trick 👍

Yea, thanks for leaving this dead end up to waste a 1/2 hour of my time trying to figure out how to get it work with the new syntax. Gave up.