Skip to content

cssnr/web-request-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

GitHub Tag Major GitHub Tag Minor GitHub Release Version GitHub Dist Size Workflow Release Workflow Test Workflow Lint Quality Gate Status GitHub Last Commit Codeberg Last Commit GitHub Contributors GitHub Repo Size GitHub Top Language GitHub Forks GitHub Discussions GitHub Repo Stars GitHub Org Stars Discord Ko-fi

Web Request Action

Easily make a web request from a workflow using Axios. Supports all methods, uploading files, basic authentication and more. Pass data/headers/params as JSON or YAML formatted strings.

- name: 'Web Request'
  uses: cssnr/web-request-action@v1
  with:
    url: https://httpbin.org/post
    method: 'POST'
    data: '{"key": "value"}'
    headers: |
      key: value
    params: |
      {
        "key": "value"
      }
    username: ${{ secrets.USERNAME }}
    password: ${{ secrets.PASSWORD }}
    insecure: false
    file: path/to/file.txt
    name: file

Note

Please submit a Feature Request for new features or Open an Issue if you find any bugs.

Inputs

Input Default Description of the Input Value
url Required URL for Request ⤵️
method POST Request Method ⤵️
data - Request Data JSON/YAML ⤵️
headers - Request Headers JSON/YAML ⤵️
params - Request Parameters JSON/YAML ⤵️
username - Basic Auth Username
password - Basic Auth Password
insecure false Ignore SSL Errors
file - File Path to Send ⤵️
name file File Form Key Name

url

The URL to send the request too. You may include params here or in the params key.

method

The request method, including custom methods.

Default: POST

data

Body JSON or YAML data. Only used for PUT, POST, DELETE, and PATCH.

Data is parsed with JSON.parse or yaml.load, js-yaml.

View JSON/YAML Example
data: |
  key1: value1
  key2: value2
data: |
  {
    "key1": "value1",
    "key2": "value2"
  }

headers

Headers JSON or YAML data.

params

Parameters, Query String, JSON or YAML data. These may also be provided in the url.

file

When sending a file, multipart/form-data wil be used and data will be added to the form data with the key name. The file path is relative to the workspace/working directory.

For more information on inputs, see: https://axios-http.com/docs/req_config

- name: 'Web Request'
  uses: cssnr/web-request-action@v1
  with:
    url: https://httpbin.org/post

Outputs

Output Description
status Response Status
headers Response Headers
data Response Data
- name: 'Web Request'
  id: test
  uses: cssnr/web-request-action@v1
  with:
    url: https://httpbin.org/post

- name: 'Echo Output'
  run: |
    echo '${{ steps.test.outputs.status }}'
    echo '${{ steps.test.outputs.headers }}'
    echo '${{ steps.test.outputs.data }}'

Examples

💡 Click on an example heading to expand or collapse the example.

Algolia Start Crawl
- name: 'Algolia Start Crawl'
  uses: cssnr/web-request-action@v1
  with:
    url: https://crawler.algolia.com/api/1/crawlers/${{ secrets.CRAWLER_ID }}/reindex
    username: ${{ secrets.CRAWLER_USER_ID }}
    password: ${{ secrets.CRAWLER_API_KEY }}
Deploy to Render
- name: 'Render Deploy'
  uses: cssnr/web-request-action@v1
  with:
    url: ${{ secrets.RENDER_HOOK }}
    params: |
      imgURL: ghcr.io/${{ github.repository }}:${{ github.ref_name }}
Make a GET Request
- name: 'Web Request'
  uses: cssnr/web-request-action@v1
  with:
    url: https://httpbin.org/get
    method: 'GET'
Send Data
- name: 'Web Request'
  uses: cssnr/web-request-action@v1
  with:
    url: https://httpbin.org/post
    data: '{"key": "value"}'
Send File
- name: 'Web Request'
  uses: cssnr/web-request-action@v1
  with:
    url: https://httpbin.org/post
    file: path/to/file.txt
    name: file # Default - name of file key
All Inputs
- name: 'Web Request'
  uses: cssnr/web-request-action@v1
  with:
    url: https://httpbin.org/post
    method: 'POST'
    data: '{"key": "value"}'
    headers: |
      key: value
    params: |
      {
        "key": "value"
      }
    username: ${{ secrets.USERNAME }}
    password: ${{ secrets.PASSWORD }}
    insecure: false
    file: path/to/file.txt
    name: file

For more examples, you can check out other projects using this action:
https://github.com/cssnr/web-request-action/network/dependents

Tags

The following rolling tags are maintained.

Tag Example Target Bugs Feat. Description
GitHub Tag Major vN vN.x.x Includes new features but is always backwards compatible.
GitHub Tag Minor vN.N vN.N.x Only receives bug fixes. This is the most stable tag.
GitHub Release vN.N.N vN.N.N Not a rolling tag. Not recommended.

You can view the release notes for each version on the releases page.

Support

For general help or to request a feature, see:

If you are experiencing an issue/bug or getting unexpected results, you can:

For more information, see the CSSNR SUPPORT.md.

Contributing

If you would like to submit a PR, please review the CONTRIBUTING.md.

Please consider making a donation to support the development of this project and additional open source projects.

Ko-fi

Additionally, you can support other GitHub Actions I have published:

❔ Unpublished Actions

These actions are not published on the Marketplace, but may be useful.


📝 Template Actions

These are basic action templates that I use for creating new actions.

Note: The docker-test-action builds, runs and pushes images to GitHub Container Registry.


For a full list of current projects to support visit: https://cssnr.github.io/

About

Web Request Action

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project