Skip to content

Commit

Permalink
Add more parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
kvanbere committed Oct 7, 2023
1 parent 49daadd commit 1500e26
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test-windows-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ jobs:
with:
uri: https://google.com/
filename: google.html
user-agent: "Cuedo"
max-redirections: 11
retries: 3
13 changes: 10 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ inputs:
description: "Invoke the specified URI"
filename:
description: "Save the output to the specified file"
user-agent:
description: "Custom user agent"
max-redirections:
description: "The maximum number of redirections"
default: 5
retries:
description: "Retry the request if it fails"
default: 3
Expand All @@ -26,7 +31,9 @@ runs:
shell: pwsh
env:
URI: ${{ format('-Uri {0}', inputs.uri) }}
FILENAME: ${{ inputs.filename > 0 && format(' -OutFile "{0}"') || '' }}
RETRIES: ${{ inputs.retries > 0 && format(' -MaximumRetryCount {0}', inputs.retries) || '' }}
FILENAME: ${{ inputs.filename != '' && format(' -OutFile "{0}"') || '' }}
USER_AGENT: ${{ inputs.user-agent != '' && format(' -UserAgent "{0}"') || '' }}
MAX_REDIRECTIONS: ${{ inputs.max-redirections != 5 '' && format(' -MaximumRedirection {0}') || '' }}
RETRIES: ${{ inputs.retries != 3 && format(' -MaximumRetryCount {0}', inputs.retries) || '' }}
run: |
Invoke-WebRequest ${{env.URI}}${{env.FILENAME}}${{env.RETRIES}}
Invoke-WebRequest ${{env.URI}}${{env.FILENAME}}${{env.MAX_REDIRECTIONS}}${{env.RETRIES}}

0 comments on commit 1500e26

Please sign in to comment.