在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:swinton/httpie.action开源软件地址:https://github.com/swinton/httpie.action开源编程语言:HCL 39.4%开源软件介绍:httpie.action
A general purpose HTTP client for GitHub Actions, wrapping the HTTPie CLI to enable human-friendly interactions with third-party web services that expose an API over HTTP in your development workflow. Why not just use webhooks?Great question! Webhooks will likely just work in the vast majority of cases In certain situations though, this may be a better solution, as it provides more fine-grained control over the HTTP request that gets sent, for example you can:
Super simple exampleTo workflow "Call external API" {
on = "push"
resolves = ["Call httpbin"]
}
action "Call httpbin" {
uses = "swinton/httpie.action@master"
args = ["POST", "httpbin.org/anything", "hello=world"]
} More examplesUsing output in a downstream actionIn this more advanced, but somewhat contrived, example we'll open an issue in the current repository, and then comment and close that issue in subsequent actions. Note, this is made possible since the response body is preserved in a file, action "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 "Comment on issue" {
needs = ["Issue"]
uses = "swinton/httpie.action@master"
args = ["--auth-type=jwt", "--auth=$GITHUB_TOKEN", "POST", "`jq .comments_url /github/home/Issue.response.body --raw-output`", "body=Thanks\\ for\\ playing\\ :v:"]
secrets = ["GITHUB_TOKEN"]
}
action "Close issue" {
needs = ["Issue"]
uses = "swinton/httpie.action@master"
args = ["--auth-type=jwt", "--auth=$GITHUB_TOKEN", "PATCH", "`jq .url /github/home/Issue.response.body --raw-output`", "state=closed"]
secrets = ["GITHUB_TOKEN"]
} Trigger another workflowIn this example, we'll trigger a separate workflow, via the repository's dispatches endpoint. Note, action "Trigger workflow" {
uses = "swinton/httpie.action@master"
args = ["--auth-type=jwt", "--auth=$PAT", "POST", "api.github.com/repos/$GITHUB_REPOSITORY/dispatches", "Accept:application/vnd.github.everest-preview+json", "event_type=demo"]
secrets = ["PAT"]
} PresetsSome HTTPie presets are applied by default by the included
PluginsA few authentication plugins are included:
More infoUsage docs for HTTPie are here. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论