http-request-action

fjogeleitMIT活跃维护

在 GitHub Actions 工作流里直接发 HTTP 请求的 Action,可调用 API、触发 Webhook 或做接口冒烟测试,省去自己写脚本。

Create HTTP Requests in GitHub Actions

v2.0.1发布于 2026-07-07 21:04 UTC309star81fork同步于 2026-11-10 12:02 UTC

怎么上手

README 里没有找到可直接复制的安装命令

README 里没有找到可直接复制的安装命令,请到 README 或官方文档查看安装方式。

硬件要求

README 没有说明硬件要求。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

这个项目的说明还在生成中,先参考下面「最近发版」和 README。

最近发版

5 个版本v2.0.1
  1. v2.0.1最新正式版2026-07-07 · 2026-07-07 21:04 UTC

    What's Changed

    New Contributors

    Full Changelog: https://github.com/fjogeleit/http-request-action/compare/v2.0...v2.0.1

  2. v2.0.02026-01-29 · 2026-01-29 13:16 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/fjogeleit/http-request-action/compare/v1...v2.0.0

  3. v1.16.62025-12-03 · 2025-12-03 15:11 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/fjogeleit/http-request-action/compare/v1.16.5...v1.16.6

  4. v1.16.52025-09-16 · 2025-09-16 06:33 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/fjogeleit/http-request-action/compare/v1.16.4...v1.16.5

  5. v1.16.4Dependency Updates2024-12-06 · 2024-12-06 15:52 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/fjogeleit/http-request-action/compare/v1...v1.16.4

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    HTTP Request Action

    Create HTTP Requests from GitHub Actions. This action allows GitHub events to engage with tools like Ansible AWX that use HTTP APIs.

    Example

    jobs:
      deployment:
        runs-on: ubuntu-latest
        steps:
        - name: Deploy Stage
          uses: fjogeleit/http-request-action@v1
          with:
            url: 'https://ansible.io/api/v2/job_templates/84/launch/'
            method: 'POST'
            username: ${{ secrets.AWX_USER }}
            password: ${{ secrets.AWX_PASSWORD }}
            customHeaders: '{"Content-Type": "application/json"}'
            data: '{"key_1": "value_1", "key_2": "value_2"}'
    

    Versioning

    master branch is deprecated. Please use main or v1 to get the latest version of this action. It is recommended to use a fixed version.

    Request Configuration

    ArgumentDescriptionDefault
    urlRequest URLrequired Field
    methodRequest MethodPOST
    contentTypeRequest Content-Typeapplication/json
    dataRequest body content:- Text content such as JSON or XML- key=value pairs separated by &, or JSON data with contentType: application/x-www-form-urlencodedOnly for POST, PUT, and PATCH requests'{}'
    filesMap of keys to absolute file paths, sent as a multipart/form-data request to the API. If set, contentType is set to multipart/form-data; values provided by data will be added as additional FormData values. Nested objects are not supported. Example provided in the test Workflow of this Action'{}'
    fileSingle absolute file path sent as an application/octet-stream request to the API. If set, contentType is set to application/octet-stream. This input is ignored if either data or files is present. Example provided in the test Workflow of this Action
    timeoutRequest Timeout in ms5000 (5s)
    usernameUsername for Basic Auth
    passwordPassword for Basic Auth
    bearerTokenBearer authentication token (without the Bearer prefix)
    customHeadersAdditional header values as a JSON string. Keys in this object overwrite default headers such as Content-Type'{}'
    escapeDataEscape newlines in data string content. Use true (string) to enable
    preventFailureOnNoResponsePrevent this action from failing if the request responds without a response. Use true (string) to enable
    ignoreStatusCodesPrevent this action from failing if the request responds with one of the configured status codes. Example: 404,401
    httpsCACertificate authority as string in PEM format
    httpsCertClient Certificate as string
    httpsKeyClient Certificate Key as string
    responseFilePersist the response data to the specified file path
    maskResponseIf set to true, the response will be masked in the action logs'false'
    retryOptional number of retries if the request fails; does not retry if the status code is ignored
    retryWaitTime between each retry in milliseconds3000
    ignoreSslIgnore SSL verification (rejectUnauthorized: false)false

    Response

    VariableDescription
    responseResponse body as a JSON string
    headersHTTP response headers as an object
    statusHTTP status code (e.g. 200, 404)
    requestErrorSet on request failure (Axios error). JSON string with fields name, message, code, and status (may be null)

    To display HTTP response data in the GitHub Actions log give the request an id and access its outputs. You can also access specific field from the response data using fromJson() expression.

    steps:
      - name: Make Request
        id: myRequest
        uses: fjogeleit/http-request-action@v1
        with:
          url: "http://yoursite.com/api"
      - name: Show Response
        run: |
          echo ${{ steps.myRequest.outputs.response }}
          echo ${{ steps.myRequest.outputs.headers }}
          echo ${{ steps.myRequest.outputs.status }}
          echo ${{ fromJson(steps.myRequest.outputs.response).field_you_want_to_access }}
    

    Additional Information

    Additional information is available if debug logging is enabled:

    • Instance Configuration (Url / Timeout / Headers)
    • Request Data (Body / Auth / Method)

    To enable debug logging in GitHub Actions, create a secret ACTIONS_RUNNER_DEBUG with a value of true.

    Local Usage

    • You can execute this tool locally with the provided CLI bin/http-action.
    bin/http-action --help
    Positionals:
      url  request URL                                                     [string]
    
    Options:
          --help           show help                                       [boolean]
      -d, --data           request body data                               [string] [default: "{}"]
      -f, --files          request files, send as multipart/form-data      [string] [default: "{}"]
          --file           single file, send as application/octet-stream   [string]
      -h, --customHeaders  custom request headers                          [string] [default: "{}"]
      -m, --method         request method (GET, POST, PATCH, PUT, DELETE)  [string] [default: "POST"]
      -t, --contentType    request content type                            [string] [default: "application/json"]
          --bearerToken    bearer token without Bearer prefix, added as
                           Authorization header                            [string]
          --timeout        request timeout                                 [number] [default: 5000]