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

Tags Test GitHub Release Version GitHub Last Commit Codeberg Last Commit GitHub Top Language GitHub Org Stars Discord

Web Request Action

Note

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

Inputs

input required default description
url Yes - URL for Request
method No POST Request Method
data No - Request Data JSON *
headers No - Request Headers JSON
params No - Request Parameters JSON *
username No - Basic Auth Username
password No - Basic Auth Password
insecure No false Ignore SSL Errors
file No - File Path to Send *
name No file File Form Key Name

data - Only used for PUT, POST, DELETE, and PATCH. Data is parsed with JSON.parse.

params - These can be specified in the URL or added here as JSON key/value pairs.

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@master
  with:
      url: https://httpbin.org/post

Outputs

output description
status Response Status
data Response Data
- name: 'Web Request'
  id: test
  uses: cssnr/web-request-action@master
  with:
      url: https://httpbin.org/post

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

Examples

Make a GET Request:

  - name: "Web Request"
    uses: cssnr/web-request-action@master
    with:
      url: https://httpbin.org/get
      method: 'GET''

Send Data:

- name: 'Web Request'
  uses: cssnr/web-request-action@master
  with:
      url: https://httpbin.org/post
      data: '{"key": "value"}'

Send File:

- name: 'Web Request'
  uses: cssnr/web-request-action@master
  with:
      url: https://httpbin.org/post
      file: path/to/file.txt

All Inputs:

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

More Examples Coming Soon...

Support

For general help or to request a feature, see:

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

Contributing

Currently, the best way to contribute to this project is to star this project on GitHub.

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

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

Development

  1. Install act: https://nektosact.com/installation/index.html
  2. Run npm run build:watch
  3. In another terminal, run act -j test

Alternatively, to run from source, change main in action.yml to src/index.js and run: act -j test --use-gitignore=false

For advanced using with things like secrets, variables and context see: https://nektosact.com/usage/index.html
You should also review the options from act --help

Note, the .env, .secrets and .vars files are automatically sourced with no extra options.
To source event.json you need to run act with act -e event.json