mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2026-02-05 00:55:52 +08:00
Compare commits
23 Commits
v1.14.1
...
support-fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f415ec7c5 | ||
|
|
25a5a55111 | ||
|
|
e1affb38cd | ||
|
|
3abafba399 | ||
|
|
17b52dc74f | ||
|
|
04de458128 | ||
|
|
6769207b0b | ||
|
|
37cfb73c02 | ||
|
|
7273a89218 | ||
|
|
d08c0d1c88 | ||
|
|
9580c192fd | ||
|
|
41c615e3c0 | ||
|
|
845e3400a7 | ||
|
|
6871522388 | ||
|
|
17c1694300 | ||
|
|
baf3fe8b8b | ||
|
|
3d8af5c847 | ||
|
|
35986be8f9 | ||
|
|
3c98f6caf2 | ||
|
|
389f30ee3a | ||
|
|
e9345a1e67 | ||
|
|
894ad39332 | ||
|
|
25fb88fa43 |
4
.github/workflows/build-action.yml
vendored
4
.github/workflows/build-action.yml
vendored
@@ -14,10 +14,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref }}
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Install dependencies
|
||||
|
||||
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
@@ -26,10 +26,10 @@ jobs:
|
||||
echo "branch=$branch" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ steps.ref.outputs.branch }}
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '16'
|
||||
- name: Install dependencies
|
||||
@@ -56,10 +56,10 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout repo
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@v3
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '16.17.0'
|
||||
- name: Build action
|
||||
@@ -77,7 +77,7 @@ jobs:
|
||||
- integrity
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
@@ -123,21 +123,31 @@ jobs:
|
||||
|
||||
- name: Create Test File
|
||||
run: |
|
||||
echo "test" > testfile.txt
|
||||
echo "test" > testfile1.txt
|
||||
echo "test" > testfile2.txt
|
||||
|
||||
- name: Request Postman Echo POST Multipart
|
||||
uses: ./
|
||||
with:
|
||||
url: 'https://postman-echo.com/post'
|
||||
method: 'POST'
|
||||
data: '{ "key": "value" }'
|
||||
files: '{ "file": "${{ github.workspace }}/testfile.txt" }'
|
||||
files: '{ "file": "${{ github.workspace }}/testfile1.txt" }'
|
||||
|
||||
- name: Request Postman Echo POST Multipart File Array
|
||||
uses: ./
|
||||
with:
|
||||
url: 'https://postman-echo.com/post'
|
||||
method: 'POST'
|
||||
data: '{ "key": "value" }'
|
||||
files: '{ "file": ["${{ github.workspace }}/testfile1.txt", "${{ github.workspace }}/testfile2.txt"] }'
|
||||
|
||||
- name: Request Postman Echo POST and persist response
|
||||
uses: ./
|
||||
with:
|
||||
url: 'https://postman-echo.com/post'
|
||||
method: 'POST'
|
||||
file: "${{ github.workspace }}/testfile.txt"
|
||||
file: "${{ github.workspace }}/testfile1.txt"
|
||||
responseFile: "${{ github.workspace }}/response.json"
|
||||
- name: Output responseFile
|
||||
run: |
|
||||
@@ -148,14 +158,14 @@ jobs:
|
||||
with:
|
||||
url: 'https://postman-echo.com/post'
|
||||
method: 'POST'
|
||||
files: '{ "file": "${{ github.workspace }}/testfile.txt" }'
|
||||
files: '{ "file": "${{ github.workspace }}/testfile1.txt" }'
|
||||
|
||||
- name: Request Postman Echo POST single file
|
||||
uses: ./
|
||||
with:
|
||||
url: 'https://postman-echo.com/post'
|
||||
method: 'POST'
|
||||
file: "${{ github.workspace }}/testfile.txt"
|
||||
file: "${{ github.workspace }}/testfile1.txt"
|
||||
|
||||
- name: Request Postman Echo POST URLEncoded string data
|
||||
uses: ./
|
||||
|
||||
@@ -42,6 +42,8 @@ jobs:
|
||||
|preventFailureOnNoResponse| Prevent this Action to fail if the request respond without an response. Use 'true' (string) as value to enable it ||
|
||||
|ignoreStatusCodes| Prevent this Action to fail if the request respond with one of the configured Status Codes. Example: '404,401' ||
|
||||
|httpsCA| Certificate authority as string in PEM format ||
|
||||
|httpsCert| Client Certificate as string ||
|
||||
|httpsKey| Client Certificate Key as string ||
|
||||
|responseFile| Persist the response data to the specified file path ||
|
||||
|retry| optional amount of retries if the request is failing, does not retry if the status code is ignored ||
|
||||
|retryWait| time between each retry in millseconds | 3000 |
|
||||
|
||||
@@ -50,6 +50,12 @@ inputs:
|
||||
httpsCA:
|
||||
description: 'Certificate authority as string in PEM format'
|
||||
required: false
|
||||
httpsCert:
|
||||
description: 'Client Certificate as string'
|
||||
required: false
|
||||
httpsKey:
|
||||
description: 'Client Certificate Key as string'
|
||||
required: false
|
||||
responseFile:
|
||||
description: 'Persist the response data to the specified file path'
|
||||
required: false
|
||||
|
||||
23866
dist/index.js
vendored
23866
dist/index.js
vendored
File diff suppressed because one or more lines are too long
3053
package-lock.json
generated
3053
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "http-request-action",
|
||||
"version": "1.14.1",
|
||||
"version": "1.14.2",
|
||||
"description": "",
|
||||
"main": "src/index.js",
|
||||
"private": false,
|
||||
@@ -19,13 +19,15 @@
|
||||
},
|
||||
"homepage": "https://github.com/fjogeleit/http-request-action#readme",
|
||||
"devDependencies": {
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"axios": "^1.4",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"axios": "^1.6",
|
||||
"form-data": "^4.0.0",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.0"
|
||||
"@actions/core": "^1.10.1",
|
||||
"install": "^0.13.0",
|
||||
"npm": "^10.2.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
|
||||
@@ -24,7 +24,7 @@ const convertToJSON = (value) => {
|
||||
*
|
||||
* @returns {FormData}
|
||||
*/
|
||||
const convertToFormData = (data, files, convertPaths) => {
|
||||
const convertToFormData = async (data, files, convertPaths) => {
|
||||
const formData = new FormData();
|
||||
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
@@ -32,7 +32,11 @@ const convertToFormData = (data, files, convertPaths) => {
|
||||
}
|
||||
|
||||
for (const [key, value] of Object.entries(files)) {
|
||||
formData.append(key, fs.createReadStream(value));
|
||||
if (Array.isArray(value)) {
|
||||
value.forEach(v => formData.append(key, fs.createReadStream(v)))
|
||||
} else {
|
||||
formData.append(key, fs.createReadStream(value));
|
||||
}
|
||||
}
|
||||
|
||||
return formData;
|
||||
|
||||
@@ -31,8 +31,12 @@ const instanceConfig = {
|
||||
headers: { ...headers, ...customHeaders }
|
||||
}
|
||||
|
||||
if (!!core.getInput('httpsCA')) {
|
||||
instanceConfig.httpsAgent = new https.Agent({ ca: core.getInput('httpsCA') })
|
||||
if (!!core.getInput('httpsCA') || !!core.getInput('httpsCert')) {
|
||||
instanceConfig.httpsAgent = new https.Agent({
|
||||
ca: core.getInput('httpsCA') || undefined,
|
||||
cert: core.getInput('httpsCert') || undefined,
|
||||
key: core.getInput('httpsKey') || undefined
|
||||
})
|
||||
}
|
||||
|
||||
if (!!core.getInput('username') || !!core.getInput('password')) {
|
||||
|
||||
Reference in New Issue
Block a user