fix: Update security-scan.yml (additional fixes)
This commit is contained in:
@@ -2,18 +2,13 @@ name: Security Vulnerability Scan
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, develop, staging ]
|
branches: [ main, develop ]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main, develop, staging ]
|
branches: [ main, develop ]
|
||||||
schedule:
|
schedule:
|
||||||
# Daily security scan at 2 AM UTC
|
# Daily security scan at 2 AM UTC
|
||||||
- cron: '0 2 * * *'
|
- cron: '0 2 * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
branch:
|
|
||||||
description: 'Branch to scan'
|
|
||||||
required: false
|
|
||||||
default: 'main'
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
security-audit:
|
security-audit:
|
||||||
@@ -23,12 +18,25 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
run: |
|
run: |
|
||||||
|
# For pull_request events, use the head ref (source branch)
|
||||||
|
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||||
|
REF_NAME="${{ github.head_ref || github.event.pull_request.head.ref }}"
|
||||||
|
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
REF_NAME="${{ inputs.branch || github.ref_name }}"
|
||||||
|
else
|
||||||
REF_NAME="${{ github.ref_name }}"
|
REF_NAME="${{ github.ref_name }}"
|
||||||
REPO="${{ github.repository }}"
|
fi
|
||||||
if [ -z "$REF_NAME" ]; then
|
|
||||||
|
# Fallback to main if REF_NAME is still empty
|
||||||
|
if [ -z "$REF_NAME" ] || [ "$REF_NAME" = "" ]; then
|
||||||
REF_NAME="main"
|
REF_NAME="main"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
REPO="${{ github.repository }}"
|
||||||
|
|
||||||
|
echo "📋 Cloning branch: $REF_NAME"
|
||||||
|
echo "📦 Repository: $REPO"
|
||||||
|
|
||||||
# Use CI token if available, otherwise try public access
|
# Use CI token if available, otherwise try public access
|
||||||
if [ -n "${{ secrets.CI_TOKEN }}" ]; then
|
if [ -n "${{ secrets.CI_TOKEN }}" ]; then
|
||||||
git clone --depth 1 --branch "$REF_NAME" \
|
git clone --depth 1 --branch "$REF_NAME" \
|
||||||
|
|||||||
Reference in New Issue
Block a user