From 90d4c503d5982c348d75219988304b64c04f0940 Mon Sep 17 00:00:00 2001 From: Shubham Sood <41718296+ShubhamSood1406@users.noreply.github.com> Date: Mon, 19 Oct 2020 18:33:42 +0530 Subject: [PATCH] Add-scanapi-version (#4) Add scanapi_version parameter --- Dockerfile | 2 -- README.md | 5 +++++ action.yml | 5 +++++ entrypoint.sh | 8 +++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 040bbfa..4f078a2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,6 @@ ENV PATH="~/.local/bin:${PATH}" RUN pip install pip setuptools --upgrade -RUN pip install scanapi - ENTRYPOINT ["/entrypoint.sh"] COPY entrypoint.sh /entrypoint.sh diff --git a/README.md b/README.md index 6c35581..23d3f5e 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ An action that allows developers to run ScanAPI using github actions. ## Inputs +### `scanapi_version` + +The version of ScanAPI to install (default: latest). + ### `arguments` Desired arguments to run scanapi. Allow multiple parameters separated by spaces. Default value is `--help` @@ -17,6 +21,7 @@ The following will take the yaml file and produce a scanapi-report.html file as - name: Run automated API tests uses: scanapi/github-action@v1 with: + scanapi_version: '==2.0.0' arguments: 'run ./scanapi.yaml' ``` diff --git a/action.yml b/action.yml index bc7b9cd..1172f31 100644 --- a/action.yml +++ b/action.yml @@ -5,6 +5,10 @@ branding: icon: "align-justify" color: "gray-dark" inputs: + scanapi_version: + description: 'The ScanAPI version to be installed' + required: false + default: 'latest' arguments: description: "Desired arguments to run ScanAPI. Allow multiple parameters separated by spaces." required: true @@ -13,4 +17,5 @@ runs: using: "docker" image: "Dockerfile" args: + - ${{ inputs.scanapi_version }} - ${{ inputs.arguments }} diff --git a/entrypoint.sh b/entrypoint.sh index 424f88e..3464764 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,4 +2,10 @@ set -e -sh -c "scanapi $*" +if [ $1 != 'latest' ]; then + pip install scanapi$1 +else + pip install scanapi +fi + +sh -c "scanapi ${@:2}"