mirror of
https://github.com/fjogeleit/http-request-action.git
synced 2024-11-24 04:41:08 -05:00
6769207b0b
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 3 to 4. - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
174 lines
4.6 KiB
YAML
174 lines
4.6 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'releases/*'
|
|
|
|
jobs:
|
|
build:
|
|
if: >
|
|
github.event_name == 'pull_request' &&
|
|
github.event.pull_request.user.login == 'dependabot[bot]'
|
|
permissions:
|
|
contents: write
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- id: ref
|
|
run: |
|
|
if [[ -n '${{ github.event.ref }}' ]]; then
|
|
branch="${{ github.event.ref }}"
|
|
echo "branch=$branch" >> $GITHUB_OUTPUT
|
|
else
|
|
branch="${{ github.event.pull_request.head.ref }}"
|
|
echo "branch=$branch" >> $GITHUB_OUTPUT
|
|
fi
|
|
- name: checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ steps.ref.outputs.branch }}
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '16'
|
|
- name: Install dependencies
|
|
run: |
|
|
npm ci
|
|
- name: Build Action
|
|
run: |
|
|
npm run build
|
|
- name: Update dist
|
|
run: |
|
|
git config user.name 'github-actions[bot]'
|
|
git config user.email 'github-actions[bot]@users.noreply.github.com'
|
|
git add ./dist
|
|
if ! git diff --quiet dist; then
|
|
git commit -m "Update dist"
|
|
git push origin HEAD:${{ steps.ref.outputs.branch }}
|
|
fi
|
|
integrity:
|
|
if: >
|
|
!failure() &&
|
|
!cancelled()
|
|
needs:
|
|
- build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: checkout repo
|
|
uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '16.17.0'
|
|
- name: Build action
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
- name: Repository Integrity Check
|
|
run: |
|
|
git diff --quiet dist
|
|
test:
|
|
if: >
|
|
!failure() &&
|
|
!cancelled()
|
|
needs:
|
|
- integrity
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.ref }}
|
|
|
|
- name: Request Postman Echo GET
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/get'
|
|
method: 'GET'
|
|
|
|
- name: Request Postman Echo POST
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/post'
|
|
method: 'POST'
|
|
data: '{ "key": "value" }'
|
|
|
|
- name: Request Postman Echo POST with Unescaped Newline
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/post'
|
|
method: 'POST'
|
|
escapeData: 'true'
|
|
data: >-
|
|
{
|
|
"key":"multi line\ntest
|
|
text"
|
|
}
|
|
|
|
- name: Request Postman Echo BasicAuth
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/basic-auth'
|
|
method: 'GET'
|
|
username: 'postman'
|
|
password: 'password'
|
|
|
|
- name: Request Postman Echo with 404 Response and ignore failure code
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/status/404'
|
|
method: 'GET'
|
|
ignoreStatusCodes: '404'
|
|
|
|
- name: Create Test File
|
|
run: |
|
|
echo "test" > testfile.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" }'
|
|
|
|
- name: Request Postman Echo POST and persist response
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/post'
|
|
method: 'POST'
|
|
file: "${{ github.workspace }}/testfile.txt"
|
|
responseFile: "${{ github.workspace }}/response.json"
|
|
- name: Output responseFile
|
|
run: |
|
|
cat "${{ github.workspace }}/response.json"
|
|
|
|
- name: Request Postman Echo POST Multipart without data
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/post'
|
|
method: 'POST'
|
|
files: '{ "file": "${{ github.workspace }}/testfile.txt" }'
|
|
|
|
- name: Request Postman Echo POST single file
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/post'
|
|
method: 'POST'
|
|
file: "${{ github.workspace }}/testfile.txt"
|
|
|
|
- name: Request Postman Echo POST URLEncoded string data
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/post'
|
|
contentType : 'application/x-www-form-urlencoded'
|
|
method: 'POST'
|
|
data: 'key=value'
|
|
|
|
- name: Request Postman Echo POST URLEncoded json data
|
|
uses: ./
|
|
with:
|
|
url: 'https://postman-echo.com/post'
|
|
contentType : 'application/x-www-form-urlencoded'
|
|
method: 'POST'
|
|
data: '{"key":"value"}'
|