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

Provide more advanced examples

swinton opened this issue · comments

We should provide a few advanced examples:

  1. Using output in a downstream action
  2. Calling the repository dispatch API
  3. Create an installation access token and take some action as a third party GitHub App
  4. Send a tweet
  5. Philips Hue something something 🤔
  6. ...

Using output in a downstream action

One example of opening an issue in the current repo, and getting those issue details in a downstream action:

action "Open issue" {
  uses = "swinton/httpie-action@master"
  args = ["--auth-type=jwt", "--auth=$GITHUB_TOKEN", "POST", "api.github.com/repos/$GITHUB_REPOSITORY/issues", "title=Hello\\ world"]
  secrets = ["GITHUB_TOKEN"]
}

action "Get issue details" {
  needs = ["Open issue"]
  uses = "actions/bin/sh@master"
  args = ["cat $HOME/Open\\ issue.response.body"]
}