From 474320f15cd102c67b451c6148b20b8e3faa0ac9 Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:25:38 +0100 Subject: [PATCH 01/10] Add sed to remove unnecessary path --- action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 7a39468..d56f587 100644 --- a/action.yml +++ b/action.yml @@ -69,9 +69,11 @@ runs: run: | if [ "${{ inputs.upload_report }}" == "true" ]; then echo "Uploading the results" + echo "Cleaning path" + cat ${{inputs.sarif_file_path}}.sarif | sed "s|$(pwd)/||g" | sed "s|file://||g" > codacy-${{inputs.sarif_file_path}}.sarif if [ "${{ inputs.project_token }}" == "" ]; then echo "Using API token" - /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} -p ${{inputs.provider}} -o ${{inputs.owner}} -r ${{inputs.repository}} + /tmp/codacy-cli-v2 upload -s codacy-${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} -p ${{inputs.provider}} -o ${{inputs.owner}} -r ${{inputs.repository}} else echo "Using project token" /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -t ${{inputs.project_token}} From 6c6963f1c291faf1ccdeb1c880f605aee048682d Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 15:29:12 +0100 Subject: [PATCH 02/10] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d56f587..83178cd 100644 --- a/action.yml +++ b/action.yml @@ -76,7 +76,7 @@ runs: /tmp/codacy-cli-v2 upload -s codacy-${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} -p ${{inputs.provider}} -o ${{inputs.owner}} -r ${{inputs.repository}} else echo "Using project token" - /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -t ${{inputs.project_token}} + /tmp/codacy-cli-v2 upload -s codacy-${{inputs.sarif_file_path}} -c $COMMIT_SHA -t ${{inputs.project_token}} fi echo "Results uploaded" else From f5ade4fabaecdb7a82e88aefc122d50a07142ddc Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:00:34 +0100 Subject: [PATCH 03/10] Update sarif file instead of creating a new one --- action.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 83178cd..2de3167 100644 --- a/action.yml +++ b/action.yml @@ -70,13 +70,14 @@ runs: if [ "${{ inputs.upload_report }}" == "true" ]; then echo "Uploading the results" echo "Cleaning path" - cat ${{inputs.sarif_file_path}}.sarif | sed "s|$(pwd)/||g" | sed "s|file://||g" > codacy-${{inputs.sarif_file_path}}.sarif + sed -i "s|$(pwd)/||g" ${{inputs.sarif_file_path}}.sarif + sed -i "s|file://||g" ${{inputs.sarif_file_path}}.sarif if [ "${{ inputs.project_token }}" == "" ]; then echo "Using API token" - /tmp/codacy-cli-v2 upload -s codacy-${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} -p ${{inputs.provider}} -o ${{inputs.owner}} -r ${{inputs.repository}} + /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} -p ${{inputs.provider}} -o ${{inputs.owner}} -r ${{inputs.repository}} else echo "Using project token" - /tmp/codacy-cli-v2 upload -s codacy-${{inputs.sarif_file_path}} -c $COMMIT_SHA -t ${{inputs.project_token}} + /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -t ${{inputs.project_token}} fi echo "Results uploaded" else From dc465aaa3028d00adaacef39092f1c7ca15d030a Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:04:39 +0100 Subject: [PATCH 04/10] Update action.yml --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 2de3167..6e498b1 100644 --- a/action.yml +++ b/action.yml @@ -70,8 +70,8 @@ runs: if [ "${{ inputs.upload_report }}" == "true" ]; then echo "Uploading the results" echo "Cleaning path" - sed -i "s|$(pwd)/||g" ${{inputs.sarif_file_path}}.sarif - sed -i "s|file://||g" ${{inputs.sarif_file_path}}.sarif + sed -i "s|$(pwd)/||g" ${{inputs.sarif_file_path}} + sed -i "s|file://||g" ${{inputs.sarif_file_path}} if [ "${{ inputs.project_token }}" == "" ]; then echo "Using API token" /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} -p ${{inputs.provider}} -o ${{inputs.owner}} -r ${{inputs.repository}} From bc5bb0ac394a8cc434063d58dd2109b92beb8973 Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:11:54 +0100 Subject: [PATCH 05/10] Update action.yml --- action.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 6e498b1..6726df3 100644 --- a/action.yml +++ b/action.yml @@ -70,8 +70,9 @@ runs: if [ "${{ inputs.upload_report }}" == "true" ]; then echo "Uploading the results" echo "Cleaning path" - sed -i "s|$(pwd)/||g" ${{inputs.sarif_file_path}} - sed -i "s|file://||g" ${{inputs.sarif_file_path}} + sed -i.bak "s|$(pwd)/||g" ${{inputs.sarif_file_path}} + sed -i.bak "s|file://||g" ${{inputs.sarif_file_path}} + cat ${{inputs.sarif_file_path}} if [ "${{ inputs.project_token }}" == "" ]; then echo "Using API token" /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} -p ${{inputs.provider}} -o ${{inputs.owner}} -r ${{inputs.repository}} From 0e6d1134c8d0bccd6a5957b7bb0dfadb71ea0b7d Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:16:19 +0100 Subject: [PATCH 06/10] Update action.yml --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 6726df3..16c6f6c 100644 --- a/action.yml +++ b/action.yml @@ -34,6 +34,7 @@ inputs: required: false description: >- Provider name (e.g., gh, gl, bb). + default: gh owner: required: false description: >- From 8826e22b167ac80e1ee2e1b8ea82bbf42c20dec4 Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:21:45 +0100 Subject: [PATCH 07/10] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 16c6f6c..e82c916 100644 --- a/action.yml +++ b/action.yml @@ -76,7 +76,7 @@ runs: cat ${{inputs.sarif_file_path}} if [ "${{ inputs.project_token }}" == "" ]; then echo "Using API token" - /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} -p ${{inputs.provider}} -o ${{inputs.owner}} -r ${{inputs.repository}} + /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} --provider gh -o ${{inputs.owner}} -r ${{inputs.repository}} else echo "Using project token" /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -t ${{inputs.project_token}} From fbf2386ebc168341a5c522fd2b83c99283658a20 Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:45:19 +0100 Subject: [PATCH 08/10] One more test --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e82c916..00a1966 100644 --- a/action.yml +++ b/action.yml @@ -76,7 +76,7 @@ runs: cat ${{inputs.sarif_file_path}} if [ "${{ inputs.project_token }}" == "" ]; then echo "Using API token" - /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -a ${{inputs.api_token}} --provider gh -o ${{inputs.owner}} -r ${{inputs.repository}} + /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -p sh -o ${{inputs.owner}} -r ${{inputs.repository}} -a ${{inputs.api_token}} else echo "Using project token" /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -t ${{inputs.project_token}} From b9f1b5acb12ddc1b241204e0511aa0b642381325 Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:48:47 +0100 Subject: [PATCH 09/10] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 00a1966..342df87 100644 --- a/action.yml +++ b/action.yml @@ -76,7 +76,7 @@ runs: cat ${{inputs.sarif_file_path}} if [ "${{ inputs.project_token }}" == "" ]; then echo "Using API token" - /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -p sh -o ${{inputs.owner}} -r ${{inputs.repository}} -a ${{inputs.api_token}} + /tmp/codacy-cli-v2 upload -s ${{ inputs.sarif_file_path }} -c $COMMIT_SHA -p sh -o ${{ inputs.owner }} -r ${{ inputs.repository }} -a ${{ inputs.api_token }} else echo "Using project token" /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -t ${{inputs.project_token}} From 2995ac86fbd63e6f8af95b001e3ad3de8c4762fc Mon Sep 17 00:00:00 2001 From: heliocodacy <46491761+heliocodacy@users.noreply.github.com> Date: Thu, 24 Oct 2024 16:50:11 +0100 Subject: [PATCH 10/10] Update action.yml --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 342df87..37b0b5b 100644 --- a/action.yml +++ b/action.yml @@ -76,7 +76,7 @@ runs: cat ${{inputs.sarif_file_path}} if [ "${{ inputs.project_token }}" == "" ]; then echo "Using API token" - /tmp/codacy-cli-v2 upload -s ${{ inputs.sarif_file_path }} -c $COMMIT_SHA -p sh -o ${{ inputs.owner }} -r ${{ inputs.repository }} -a ${{ inputs.api_token }} + /tmp/codacy-cli-v2 upload -s ${{ inputs.sarif_file_path }} -c $COMMIT_SHA -p gh -o ${{ inputs.owner }} -r ${{ inputs.repository }} -a ${{ inputs.api_token }} else echo "Using project token" /tmp/codacy-cli-v2 upload -s ${{inputs.sarif_file_path}} -c $COMMIT_SHA -t ${{inputs.project_token}}