From 7bd4239b5c783e9c799612d0d241fae1fab428d8 Mon Sep 17 00:00:00 2001 From: ErebusZ Date: Tue, 27 Aug 2024 14:53:59 +0100 Subject: [PATCH] Change from docker to composite action to support all os workflows --- Dockerfile | 10 ---------- action.yml | 29 +++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 12 deletions(-) delete mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 75906e5..0000000 --- a/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM python:3.10-alpine as base -FROM base as builder -RUN apk add build-base -RUN mkdir /install -WORKDIR /install -RUN pip install --prefix=/install ostorlab -FROM base -WORKDIR /root/ -COPY --from=builder /install /usr/local -CMD ostorlab --api-key="$INPUT_OSTORLAB_API_KEY" ci-scan run --log-flavor=github --title="$INPUT_SCAN_TITLE" --scan-profile="$INPUT_SCAN_PROFILE" --break-on-risk-rating="$INPUT_BREAK_ON_RISK_RATING" --max-wait-minutes="$INPUT_MAX_WAIT_MINUTES" $INPUT_EXTRA $INPUT_ASSET_TYPE $INPUT_TARGET diff --git a/action.yml b/action.yml index b5d9ba1..69197a7 100644 --- a/action.yml +++ b/action.yml @@ -34,8 +34,33 @@ outputs: status: description: status of scan. runs: - using: 'docker' - image: 'Dockerfile' + using: "composite" + steps: + - name: Set up Python3.11 + uses: actions/setup-python@v5.0.0 + with: + python-version: 3.11 + + - name: Install Ostorlab + run: | + python -m pip install --upgrade pip + python -m pip install ostorlab + shell: bash + + - name: Run Scan + run: | + ostorlab --api-key="$INPUT_OSTORLAB_API_KEY" ci-scan run --log-flavor=github --title="$INPUT_SCAN_TITLE" --scan-profile="$INPUT_SCAN_PROFILE" --break-on-risk-rating="$INPUT_BREAK_ON_RISK_RATING" --max-wait-minutes="$INPUT_MAX_WAIT_MINUTES" $INPUT_EXTRA $INPUT_ASSET_TYPE $INPUT_TARGET + shell: bash + env: + INPUT_OSTORLAB_API_KEY: ${{ inputs.ostorlab_api_key }} + INPUT_SCAN_TITLE: ${{ inputs.scan_title }} + INPUT_SCAN_PROFILE: ${{ inputs.scan_profile }} + INPUT_BREAK_ON_RISK_RATING: ${{ inputs.break_on_risk_rating }} + INPUT_MAX_WAIT_MINUTES: ${{ inputs.max_wait_minutes }} + INPUT_EXTRA: ${{ inputs.extra }} + INPUT_ASSET_TYPE: ${{ inputs.asset_type }} + INPUT_TARGET: ${{ inputs.target }} + branding: icon: "shield" color: "blue"