From 25f21def22941e14a0ba576facbea91f471137df Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Tue, 28 Oct 2025 13:05:10 -0700
Subject: [PATCH 1/3] Add Headers to Outputs
---
.github/workflows/test.yaml | 5 +++--
README.md | 43 ++++++++++++++++++++++++++++---------
action.yml | 2 ++
dist/index.js | 18 +++++++++++-----
package-lock.json | 8 +++----
package.json | 2 +-
src/index.js | 12 +++++++++--
7 files changed, 66 insertions(+), 24 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index fe15f89..0996fe6 100644
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -45,8 +45,9 @@ jobs:
- name: "Verify Outputs"
run: |
- echo '${{ steps.test.outputs.status }}'
- echo '${{ steps.test.outputs.data }}'
+ echo 'status: ${{ steps.test.outputs.status }}'
+ echo 'headers: ${{ steps.test.outputs.headers }}'
+ echo 'data: ${{ steps.test.outputs.data }}'
if [ '${{ fromJson(steps.test.outputs.data).data }}' != '{"key":"value"}' ];then
echo "Output Invalid"
exit 1
diff --git a/README.md b/README.md
index 700aa9d..7f87032 100644
--- a/README.md
+++ b/README.md
@@ -29,6 +29,27 @@
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.
+
+```yaml
+- 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](https://github.com/cssnr/web-request-action/discussions/categories/feature-requests)
@@ -57,16 +78,16 @@ Only used for `PUT`, `POST`, `DELETE`, and `PATCH`. Data is parsed with `JSON.pa
```yaml
data: |
- {
- "key1": "value1",
- "key2": "value2"
- }
+ key1: value1
+ key2: value2
```
```yaml
data: |
- key1: value1
- key2: value2
+ {
+ "key1": "value1",
+ "key2": "value2"
+ }
```
@@ -91,10 +112,11 @@ For more information on inputs, see: https://axios-http.com/docs/req_config
## Outputs
-| Output | Description |
-| :----- | :-------------- |
-| status | Response Status |
-| data | Response Data |
+| Output | Description |
+| :------ | :--------------- |
+| status | Response Status |
+| headers | Response Headers |
+| data | Response Data |
```yaml
- name: 'Web Request'
@@ -106,6 +128,7 @@ For more information on inputs, see: https://axios-http.com/docs/req_config
- name: 'Echo Output'
run: |
echo '${{ steps.test.outputs.status }}'
+ echo '${{ steps.test.outputs.headers }}'
echo '${{ steps.test.outputs.data }}'
```
diff --git a/action.yml b/action.yml
index b3afea1..1b4f434 100644
--- a/action.yml
+++ b/action.yml
@@ -34,6 +34,8 @@ inputs:
outputs:
status:
description: "Response Status"
+ headers:
+ description: "Response Headers"
data:
description: "Response Data"
diff --git a/dist/index.js b/dist/index.js
index 9aae5cf..7a85a21 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -36240,7 +36240,7 @@ module.exports = parseParams
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-/*! Axios v1.13.0 Copyright (c) 2025 Matt Zabriskie and contributors */
+/*! Axios v1.13.1 Copyright (c) 2025 Matt Zabriskie and contributors */
const FormData$1 = __nccwpck_require__(6454);
@@ -38400,7 +38400,7 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
return requestedURL;
}
-const VERSION = "1.13.0";
+const VERSION = "1.13.1";
function parseProtocol(url) {
const match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
@@ -39676,7 +39676,7 @@ const httpAdapter = isHttpAdapterSupported && function httpAdapter(config) {
if (responseType === 'stream') {
response.data = responseStream;
- settle(resolve, abort, response);
+ settle(resolve, reject, response);
} else {
const responseBuffer = [];
let totalResponseBytes = 0;
@@ -41538,6 +41538,7 @@ const yaml = __nccwpck_require__(4281)
;(async () => {
try {
// Inputs
+ core.startGroup('Inputs')
const url = core.getInput('url', { required: true })
console.log('url:', url)
const method = core.getInput('method', { required: true })
@@ -41558,6 +41559,7 @@ const yaml = __nccwpck_require__(4281)
console.log('file:', file)
const name = core.getInput('name')
console.log('name:', name)
+ core.endGroup() // Inputs
// Options
const auth = username && password ? { username, password } : {}
@@ -41592,14 +41594,20 @@ const yaml = __nccwpck_require__(4281)
}
console.log('config:', config)
const response = await axios.request(config)
+ console.log('response.status:', response.status)
// console.log('response:', response)
// console.log('response.request._headers:', response.request._headers)
- // console.log('response.headers:', response.headers)
- console.log('response.status:', response.status)
+ core.startGroup('Headers')
+ console.log('response.headers:', response.headers)
+ core.endGroup() // Headers
+
+ core.startGroup('Data')
console.log('response.data:', response.data)
+ core.endGroup() // Data
// Outputs
core.setOutput('status', response.status)
+ core.setOutput('headers', response.headers)
core.setOutput('data', response.data)
core.info(`\u001b[32;1mFinished Success`)
diff --git a/package-lock.json b/package-lock.json
index 3cec242..5810fb1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7,7 +7,7 @@
"name": "web-request-action",
"dependencies": {
"@actions/core": "^1.11.1",
- "axios": "^1.13.0",
+ "axios": "^1.13.1",
"form-data": "^4.0.4",
"js-yaml": "^4.1.0"
},
@@ -351,9 +351,9 @@
"license": "MIT"
},
"node_modules/axios": {
- "version": "1.13.0",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.0.tgz",
- "integrity": "sha512-zt40Pz4zcRXra9CVV31KeyofwiNvAbJ5B6YPz9pMJ+yOSLikvPT4Yi5LjfgjRa9CawVYBaD1JQzIVcIvBejKeA==",
+ "version": "1.13.1",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.13.1.tgz",
+ "integrity": "sha512-hU4EGxxt+j7TQijx1oYdAjw4xuIp1wRQSsbMFwSthCWeBQur1eF+qJ5iQ5sN3Tw8YRzQNKb8jszgBdMDVqwJcw==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.15.6",
diff --git a/package.json b/package.json
index 96d6361..5614c4b 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"@actions/core": "^1.11.1",
- "axios": "^1.13.0",
+ "axios": "^1.13.1",
"form-data": "^4.0.4",
"js-yaml": "^4.1.0"
},
diff --git a/src/index.js b/src/index.js
index 9522eda..e6b7e0a 100644
--- a/src/index.js
+++ b/src/index.js
@@ -8,6 +8,7 @@ const yaml = require('js-yaml')
;(async () => {
try {
// Inputs
+ core.startGroup('Inputs')
const url = core.getInput('url', { required: true })
console.log('url:', url)
const method = core.getInput('method', { required: true })
@@ -28,6 +29,7 @@ const yaml = require('js-yaml')
console.log('file:', file)
const name = core.getInput('name')
console.log('name:', name)
+ core.endGroup() // Inputs
// Options
const auth = username && password ? { username, password } : {}
@@ -62,14 +64,20 @@ const yaml = require('js-yaml')
}
console.log('config:', config)
const response = await axios.request(config)
+ console.log('response.status:', response.status)
// console.log('response:', response)
// console.log('response.request._headers:', response.request._headers)
- // console.log('response.headers:', response.headers)
- console.log('response.status:', response.status)
+ core.startGroup('Headers')
+ console.log('response.headers:', response.headers)
+ core.endGroup() // Headers
+
+ core.startGroup('Data')
console.log('response.data:', response.data)
+ core.endGroup() // Data
// Outputs
core.setOutput('status', response.status)
+ core.setOutput('headers', response.headers)
core.setOutput('data', response.data)
core.info(`\u001b[32;1mFinished Success`)
From 272674c849ad15a9c019cd66c7d4ddbc3d9da650 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Tue, 28 Oct 2025 13:30:42 -0700
Subject: [PATCH 2/3] Update README.md
---
README.md | 38 ++++++++++++++++++++++++++++++--------
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/README.md b/README.md
index 7f87032..9b35e07 100644
--- a/README.md
+++ b/README.md
@@ -59,10 +59,10 @@ Pass data/headers/params as JSON or YAML formatted strings.
| Input | Default | Description of the Input Value |
| :------- | :--------- | :------------------------------------------------- |
-| url | _Required_ | URL for Request |
-| method | `POST` | Request Method |
+| url | _Required_ | URL for Request [⤵️](#url) |
+| method | `POST` | Request Method [⤵️](#method) |
| data | - | Request Data JSON/YAML [⤵️](#data) |
-| headers | - | Request Headers JSON/YAML |
+| headers | - | Request Headers JSON/YAML [⤵️](#headers) |
| params | - | Request Parameters JSON/YAML [⤵️](#params) |
| username | - | Basic Auth Username |
| password | - | Basic Auth Password |
@@ -70,9 +70,21 @@ Pass data/headers/params as JSON or YAML formatted strings.
| file | - | File Path to Send [⤵️](#file) |
| name | `file` | File Form Key Name |
+### url
+
+The URL to send the request too. You may include params here or in the [params](#params) key.
+
+### method
+
+The request method, including custom methods.
+
+Default: `POST`
+
### data
-Only used for `PUT`, `POST`, `DELETE`, and `PATCH`. Data is parsed with `JSON.parse` then `yaml.load`.
+Body JSON or YAML data. Only used for `PUT`, `POST`, `DELETE`, and `PATCH`.
+
+Data is parsed with `JSON.parse` or `yaml.load`, [js-yaml](https://github.com/nodeca/js-yaml).
View Multi-Line JSON/YAML Example
@@ -92,9 +104,13 @@ data: |
+### headers
+
+Headers JSON or YAML data.
+
### params
-These can be specified in the URL or added here as JSON key/value pairs.
+Parameters, Query String, JSON or YAML data. These may also be provided in the [url](#url).
### file
@@ -155,7 +171,8 @@ For more information on inputs, see: https://axios-http.com/docs/req_config
uses: cssnr/web-request-action@v1
with:
url: ${{ secrets.RENDER_HOOK }}
- params: '{"imgURL": "ghcr.io/${{ github.repository }}:${{ github.ref_name }}"}'
+ params: |
+ imgURL: ghcr.io/${{ github.repository }}:${{ github.ref_name }}
```
@@ -189,6 +206,7 @@ For more information on inputs, see: https://axios-http.com/docs/req_config
with:
url: https://httpbin.org/post
file: path/to/file.txt
+ name: file # Default - name of file key
```
@@ -201,8 +219,12 @@ For more information on inputs, see: https://axios-http.com/docs/req_config
url: https://httpbin.org/post
method: 'POST'
data: '{"key": "value"}'
- headers: '{"header": "value"}'
- params: '{"parameter": "value"}'
+ headers: |
+ key: value
+ params: |
+ {
+ "key": "value"
+ }
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
insecure: false
From 83c8d4f8567de8a1b2eb1ec04c97086b86d974a5 Mon Sep 17 00:00:00 2001
From: Shane <6071159+smashedr@users.noreply.github.com>
Date: Tue, 28 Oct 2025 13:55:40 -0700
Subject: [PATCH 3/3] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 9b35e07..a53393f 100644
--- a/README.md
+++ b/README.md
@@ -86,7 +86,7 @@ Body JSON or YAML data. Only used for `PUT`, `POST`, `DELETE`, and `PATCH`.
Data is parsed with `JSON.parse` or `yaml.load`, [js-yaml](https://github.com/nodeca/js-yaml).
-View Multi-Line JSON/YAML Example
+View JSON/YAML Example
```yaml
data: |