Skip to content

Commit

Permalink
Add linux support
Browse files Browse the repository at this point in the history
  • Loading branch information
kvanbere committed Oct 7, 2023
1 parent 40aa586 commit a31ee4f
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

custom: https://cuedo.com.au/contact
16 changes: 16 additions & 0 deletions .github/workflows/test-macos-latest.yml
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions .github/workflows/test-ubuntu-latest.yml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 16 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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) || '' }}
Expand Down

0 comments on commit a31ee4f

Please sign in to comment.