diff --git a/.gitignore b/.gitignore index 6eca42a..1b001f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ -.github/instructions \ No newline at end of file +.github/instructions +.codacy/ \ No newline at end of file diff --git a/README.md b/README.md index 6066efd..e36b567 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,4 @@ steps: | `tool` | Yes | - | The tool to use for analysis. | | `upload_report` | No | false | Whether to upload the report to Codacy. | | `sarif_file_path` | No | "./report.sarif" | The path to the SARIF file to upload. | +| `tool_config_path` | No | - | The path to the tool configuration file you need for the analysis. | diff --git a/action.yml b/action.yml index aa45524..a62bf01 100644 --- a/action.yml +++ b/action.yml @@ -47,6 +47,11 @@ inputs: default: "" description: >- Eventual registry address. + tool_config_path: + required: false + default: "" + description: >- + Path to the tool configuration file to use for the analysis. If not provided, the action will rely on the default configuration provided by Codacy CLI V2. runs: using: "composite" @@ -64,6 +69,9 @@ runs: if [ "${{ inputs.api_token }}" != "" ]; then /tmp/codacy-cli-v2 init --api-token ${{inputs.api_token}} --provider ${{inputs.provider}} --organization ${{inputs.owner}} --repository ${{inputs.repository}} fi + if [ "${{ inputs.tool_config_path }}" != "" ]; then + mv "${{ inputs.tool_config_path }}" ./.codacy/tools-configs/ + fi if [ "${{ inputs.registry }}" != "" ]; then /tmp/codacy-cli-v2 install -r ${{ inputs.registry }} else @@ -75,7 +83,7 @@ runs: run: | echo "Running the tool" if [ "${{ inputs.api_token }}" != "" ]; then - /tmp/codacy-cli-v2 analyze -t ${{inputs.tool}} ${{inputs.directory}} --format sarif -o ${{inputs.sarif_file_path}} --api-token ${{inputs.api_token}} --provider ${{inputs.provider}} --organization ${{inputs.owner}} --repository ${{inputs.repository}} + /tmp/codacy-cli-v2 analyze -t ${{inputs.tool}} --format sarif -o ${{inputs.sarif_file_path}} --api-token ${{inputs.api_token}} --provider ${{inputs.provider}} --organization ${{inputs.owner}} --repository ${{inputs.repository}} else /tmp/codacy-cli-v2 analyze -t ${{inputs.tool}} --format sarif -o ${{inputs.sarif_file_path}} fi