diff --git a/action.yml b/action.yml index f9271d8..4f0f746 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,9 @@ inputs: uri: required: true description: "Invoke the specified URI" + content-type: + description: "Set the content type of the request" + default: 'application/json' filename: description: "Save the output to the specified file" user-agent: @@ -18,6 +21,12 @@ inputs: retries: description: "Retry the request if it fails" default: 3 + retry-interval: + description: "The retry interval in seconds" + default: 5 + retry-timeout: + description: "The time in seconds before each request will timeout and retry if possible" + default: 60 runs: using: "composite" steps: @@ -30,10 +39,13 @@ runs: if: runner.os == 'Windows' shell: pwsh env: - URI: ${{ format('-Uri {0}', inputs.uri) }} + URI: ${{ format('-Uri "{0}"', inputs.uri) }} + CONTENT_TYPE: ${{ format(' -ContentType "{0}"', inputs.content-type) }} FILENAME: ${{ inputs.filename != '' && format(' -OutFile "{0}"', inputs.filename) || '' }} USER_AGENT: ${{ inputs.user-agent != '' && format(' -UserAgent "{0}"', inputs.user-agent) || '' }} MAX_REDIRECTIONS: ${{ inputs.max-redirections != 5 && format(' -MaximumRedirection {0}', inputs.max-redirections) || '' }} RETRIES: ${{ inputs.retries != 3 && format(' -MaximumRetryCount {0}', inputs.retries) || '' }} + RETRY_INTERVAL: ${{ inputs.retry-interval != 5 && format(' -RetryIntervalSec {0}', inputs.retry-interval) || '' }} + RETRY_TIMEOUT: ${{ inputs.retry-timeout != 5 && format(' -TimeoutSec {0}', inputs.retry-timeout) || '' }} run: | - Invoke-WebRequest ${{env.URI}}${{env.FILENAME}}${{env.USER_AGENT}}${{env.MAX_REDIRECTIONS}}${{env.RETRIES}} + Invoke-WebRequest ${{env.URI}}${{env.CONTENT_TYPE}}${{env.FILENAME}}${{env.USER_AGENT}}${{env.MAX_REDIRECTIONS}}${{env.RETRIES}}${{env.RETRY_INTERVAL}}${{env.RETRY_TIMEOUT}}