fix: url encode owner, repo, and branch name (#7)
All checks were successful
CD / Release (push) Successful in 1m49s

Reviewed-on: #7
Co-authored-by: Timo Behrendt <t.behrendt@t00n.de>
Co-committed-by: Timo Behrendt <t.behrendt@t00n.de>
This commit was merged in pull request #7.
This commit is contained in:
2026-02-12 20:23:23 +01:00
committed by t.behrendt
parent cd7a5213f7
commit 5e1031a9ef

View File

@@ -1,23 +1,23 @@
name: 'TAS Upload SARIF' name: "TAS Upload SARIF"
description: 'Upload a SARIF report to TAS (Tea Advanced Security) and fail the job if gating returns allowed: false' description: "Upload a SARIF report to TAS (Tea Advanced Security) and fail the job if gating returns allowed: false"
inputs: inputs:
tas-base-url: tas-base-url:
description: 'Base URL of the TAS API (e.g. https://tas.example.com)' description: "Base URL of the TAS API (e.g. https://tas.example.com)"
required: true required: true
sarif-file: sarif-file:
description: 'Path to the SARIF report file (JSON)' description: "Path to the SARIF report file (JSON)"
required: true required: true
owner: owner:
description: 'Repository owner (default: GitHub repository owner)' description: "Repository owner (default: GitHub repository owner)"
required: false required: false
repo: repo:
description: 'Repository name (default: GitHub repository name)' description: "Repository name (default: GitHub repository name)"
required: false required: false
branch: branch:
description: 'Branch name (default: current ref name, e.g. main)' description: "Branch name (default: current ref name, e.g. main)"
required: false required: false
runs: runs:
using: 'composite' using: "composite"
steps: steps:
- name: Upload SARIF to TAS and gate - name: Upload SARIF to TAS and gate
shell: bash shell: bash
@@ -29,7 +29,10 @@ runs:
SARIF_FILE: ${{ inputs.sarif-file }} SARIF_FILE: ${{ inputs.sarif-file }}
run: | run: |
BASE_URL="${BASE_URL%/}" BASE_URL="${BASE_URL%/}"
URL="${BASE_URL}/repos/${OWNER}/${REPO}/branches/${BRANCH}/reports" OWNER_ENC=$(jq -rn --arg x "$OWNER" '$x | @uri')
REPO_ENC=$(jq -rn --arg x "$REPO" '$x | @uri')
BRANCH_ENC=$(jq -rn --arg x "$BRANCH" '$x | @uri')
URL="${BASE_URL}/repos/${OWNER_ENC}/${REPO_ENC}/branches/${BRANCH_ENC}/reports"
echo "Uploading SARIF to TAS: $URL" echo "Uploading SARIF to TAS: $URL"
if [[ ! -f "$SARIF_FILE" ]]; then if [[ ! -f "$SARIF_FILE" ]]; then