diff --git a/README.md b/README.md index 83a7fb3..0744b70 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,12 @@ jobs: # choose if the force pass or not force_pass: true + + # save the results to a file + save: results.csv + + # The results format saved to a file. Supported: 'csv' or 'sarif'. Default is csv + format: csv ``` ## Inputs @@ -138,7 +144,8 @@ jobs: | `print_all` | optional | Choose whether to include file with no URLs in the prints. | | `verbose` | optional | Choose whether to print a more verbose end summary with files and broken URLs | | `retry_count` | optional | If a request fails, retry this number of times. Defaults to 1 | -| `save` | optional | A path to a csv file to save results to | +| `save` | optional | A path to a file to save results to | +| `format` | optional | The results format saved to a file. Supported: 'csv' or 'sarif'. Default is csv | | `timeout` | optional | The timeout to provide to requests to wait for a response. | | `exclude_urls` | optional | A comma separated list of links. | | `exclude_patterns` | optional | A comma separated list of patterns. | diff --git a/action.yml b/action.yml index 4fda049..4079592 100644 --- a/action.yml +++ b/action.yml @@ -56,7 +56,12 @@ inputs: default: 1 save: - description: "A csv file path to save the results to." + description: "A file path to save the results to." + required: false + default: "" + + format: + description: "The results format saved to a file. Supported: 'csv' or 'sarif'. Default is csv." required: false default: "" diff --git a/entrypoint.sh b/entrypoint.sh index 107ed36..34602a0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -90,6 +90,11 @@ if [ ! -z "${INPUT_SAVE}" ]; then COMMAND="${COMMAND} --save ${INPUT_SAVE}" fi +# format (optional) +if [ ! -z "${INPUT_FORMAT}" ]; then + COMMAND="${COMMAND} --format ${INPUT_FORMAT}" +fi + # force pass (optional) if [ "${INPUT_FORCE_PASS}" == "true" ]; then echo "Force pass requested." diff --git a/examples/urlchecker-save-artifact-sarif.yml b/examples/urlchecker-save-artifact-sarif.yml new file mode 100644 index 0000000..1a34a01 --- /dev/null +++ b/examples/urlchecker-save-artifact-sarif.yml @@ -0,0 +1,49 @@ +name: Check URLs SARIF format + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: urls-checker + uses: urlstechie/urlchecker-action@master + with: + # A subfolder or path to navigate to in the present or cloned repository + subfolder: docs + + # A comma-separated list of file types to cover in the URL checks + file_types: .md,.py,.rst + + # Choose whether to include file with no URLs in the prints. + print_all: false + + # The timeout seconds to provide to requests, defaults to 5 seconds + timeout: 5 + + # How many times to retry a failed request (each is logged, defaults to 1) + retry_count: 3 + + # A comma separated links to exclude during URL checks + exclude_urls: https://github.com/SuperKogito/URLs-checker/issues/1,https://github.com/SuperKogito/URLs-checker/issues/2 + + # A comma separated patterns to exclude during URL checks + exclude_patterns: https://github.com/SuperKogito/Voice-based-gender-recognition/issues + + # choose if the force pass or not + force_pass : true + + # Save to results.sarif + save: results.sarif + + # Save SARIF format + format: sarif + + - name: Upload check results + if: always() + uses: actions/upload-artifact@v2-preview + with: + name: urlchecker-results + path: results.sarif