├── .github └── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── LICENSE ├── README.md ├── action.yml └── entrypoint.sh /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @scanapi/core-team @scanapi/maintaners 2 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As one of the repositories under the `scanapi` GitHub organization, this repository follows the 4 | [ScanAPI Code of Conduct](https://github.com/scanapi/contributors/blob/master/CODE_OF_CONDUCT.md). 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thanks for taking the time to contribute! 🙇‍♀️🙇‍♂️ Every little bit of help counts! 4 | 5 | Also, as one of the repositories under the `scanapi` GitHub organization, this repository follows 6 | the [ScanAPI Contributing Guideline](https://github.com/scanapi/contributors/blob/master/CONTRIBUTING.md). 7 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.10.0a6-slim 2 | 3 | LABEL maintainer="github.com/camilamaia" 4 | 5 | ENV PATH="~/.local/bin:${PATH}" 6 | 7 | RUN pip install pip setuptools --upgrade 8 | 9 | ENTRYPOINT ["/entrypoint.sh"] 10 | 11 | COPY entrypoint.sh /entrypoint.sh 12 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 ScanAPI 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](https://github.com/scanapi/design/raw/main/images/github-hero-dark.png) 2 | 3 | # ScanaAPI 4 | An action that allows developers to run ScanAPI using github actions. 5 | 6 | ## Inputs 7 | 8 | ### `scanapi_version` 9 | 10 | The version of ScanAPI to install (default: latest). 11 | 12 | ### `arguments` 13 | 14 | Desired arguments to run scanapi. Allow multiple parameters separated by spaces. Default value is `--help` 15 | 16 | ## Example usage 17 | 18 | The following will take the yaml file and produce a scanapi-report.html file as output. 19 | 20 | ```yaml 21 | - name: Run automated API tests 22 | uses: scanapi/github-action@v1 23 | with: 24 | scanapi_version: '==2.0.0' 25 | arguments: 'run ./scanapi.yaml' 26 | ``` 27 | 28 | ## Example workflow 29 | 30 | Complete example used in a workflow/yaml file. This produce a scanapi-report.html file as output. 31 | 32 | ```yaml 33 | name: Run tests 34 | on: 35 | pull_request: 36 | types: [opened, synchronize]: 37 | 38 | jobs: 39 | scanapi: 40 | runs-on: ubuntu-latest 41 | steps: 42 | - uses: actions/checkout@v2 43 | - name: Run automated API tests 44 | uses: scanapi/github-action@v1 45 | with: 46 | arguments: "run ./scanapi.yaml" 47 | - name: Upload scanapi-report.html 48 | uses: actions/upload-artifact@v2 49 | if: ${{ always() }} 50 | with: 51 | name: ScanAPI Report 52 | path: scanapi-report.html 53 | ``` 54 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "ScanAPI" 2 | author: "@scanapi" 3 | description: "Allows any developer to run ScanAPI using github actions" 4 | branding: 5 | icon: "align-justify" 6 | color: "gray-dark" 7 | inputs: 8 | scanapi_version: 9 | description: 'The ScanAPI version to be installed' 10 | required: false 11 | default: 'latest' 12 | arguments: 13 | description: "Desired arguments to run ScanAPI. Allow multiple parameters separated by spaces." 14 | required: true 15 | default: "--help" 16 | runs: 17 | using: "docker" 18 | image: "Dockerfile" 19 | args: 20 | - ${{ inputs.scanapi_version }} 21 | - ${{ inputs.arguments }} 22 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ $1 != 'latest' ]; then 6 | pip install scanapi$1 7 | else 8 | pip install scanapi 9 | fi 10 | 11 | sh -c "scanapi ${@:2}" 12 | --------------------------------------------------------------------------------