diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..0a56673 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +custom: https://cuedo.com.au/contact \ No newline at end of file diff --git a/.github/workflows/test-macos-latest.yml b/.github/workflows/test-macos-latest.yml new file mode 100644 index 0000000..217c887 --- /dev/null +++ b/.github/workflows/test-macos-latest.yml @@ -0,0 +1,16 @@ +on: [push] +name: test-macos-latest +jobs: + test-action: + name: Test + runs-on: macOS-latest + + steps: + - uses: actions/checkout@v3 + - uses: ./ + with: + uri: https://google.com/ + filename: google.html + user-agent: "Cuedo" + max-redirections: 11 + retries: 3 diff --git a/.github/workflows/test-ubuntu-latest.yml b/.github/workflows/test-ubuntu-latest.yml new file mode 100644 index 0000000..bdc7d70 --- /dev/null +++ b/.github/workflows/test-ubuntu-latest.yml @@ -0,0 +1,16 @@ +on: [push] +name: test-ubuntu-latest +jobs: + test-action: + name: Test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: ./ + with: + uri: https://google.com/ + filename: google.html + user-agent: "Cuedo" + max-redirections: 11 + retries: 3 diff --git a/action.yml b/action.yml index c3d6391..535f1d3 100644 --- a/action.yml +++ b/action.yml @@ -7,13 +7,14 @@ branding: inputs: method: description: "Specifies the method used for the web request" - default: "get" + default: 'GET' # Must be all-caps uri: required: true description: "Invoke the specified URI" content-type: description: "Set the content type of the request" default: 'application/json' + # Shall we allow an Accept: setting for the content type? filename: description: "Save the output to the specified file" user-agent: @@ -36,13 +37,24 @@ runs: - name: Invoke URI (Linux) if: runner.os == 'Linux' shell: bash - run: export DISPLAY="127.0.0.1:10.0" - + env: + METHOD: ${{ format('-X ''{0}''', inputs.method) }} + URI: ${{ format(' ''{0}''', inputs.uri) }} + CONTENT_TYPE: ${{ format(' -H ''Content-Type: {0}''', inputs.content-type) }} + FILENAME: ${{ inputs.filename != '' && format(' -o ''{0}''', inputs.filename) || '' }} + USER_AGENT: ${{ inputs.user-agent != '' && format(' --user-agent ''{0}''', inputs.user-agent) || '' }} + MAX_REDIRECTIONS: ${{ inputs.max-redirections != 5 && format(' --max-redirs {0}', inputs.max-redirections) || '' }} + RETRIES: ${{ inputs.retries != 3 && format(' --retry {0} --retry-all-errors', inputs.retries) || '' }} + RETRY_INTERVAL: ${{ inputs.retry-interval != 5 && format(' -retry-delay {0}', inputs.retry-interval) || '' }} + RETRY_TIMEOUT: ${{ inputs.retry-timeout != 5 && format(' --retry-max-time {0}', inputs.retry-timeout) || '' }} + run: | + curl ${{env.METHOD}}${{env.CONTENT_TYPE}}${{env.FILENAME}}${{env.USER_AGENT}}${{env.MAX_REDIRECTIONS}}${{env.RETRIES}}${{env.RETRY_INTERVAL}}${{env.RETRY_TIMEOUT}}${{env.URI}} + - name: Invoke URI (Windows) if: runner.os == 'Windows' shell: pwsh env: - METHOD: ${{ format(' -Method ''{0}''', inputs.method) }} + METHOD: ${{ format('-Method ''{0}''', inputs.method) }} URI: ${{ format(' -Uri ''{0}''', inputs.uri) }} CONTENT_TYPE: ${{ format(' -ContentType ''{0}''', inputs.content-type) }} FILENAME: ${{ inputs.filename != '' && format(' -PassThru -OutFile ''{0}''', inputs.filename) || '' }}