Skip to content

Commit

Permalink
Make conditional for branch PR vs Commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavier Metichecchia authored and Xavier Metichecchia committed Jul 18, 2024
1 parent 478f035 commit 2818f6a
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/thog_scan_commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ jobs:
sudo apt-get update
sudo apt-get install -y gh
- name: Set branch name
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV
- name: Determine the branch name
id: determine-branch
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
else
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
fi
- name: Authenticate GitHub CLI
env:
Expand All @@ -53,9 +59,8 @@ jobs:
- name: TruffleHog3 Scan
id: scan
run: |
BRANCH_NAME=${GITHUB_REF#refs/heads/}
echo "Scanning branch: $BRANCH_NAME"
trufflehog3 --branch $BRANCH_NAME --no-entropy --severity MEDIUM -vv -c .trufflehog3.yml -r rules.yml --format json --output truffleHogResults.json || true
echo "Scanning branch: $BRANCH"
trufflehog3 --branch $BRANCH --no-entropy --severity MEDIUM -vv -c .trufflehog3.yml -r rules.yml --format json --output truffleHogResults.json || true
trufflehog3 -R truffleHogResults.json --output truffleHogReport.html
- name: Cloud.gov login
Expand All @@ -65,7 +70,6 @@ jobs:
CF_ORG: "${{ secrets.CF_ORG }}"
PROJECT: "${{ secrets.PROJECT }}"
run: |
BRANCH=${GITHUB_REF#refs/heads/}
source ./scripts/pipeline/cloud-gov-login.sh
- name: Upload Trufflehog Results
Expand Down

0 comments on commit 2818f6a

Please sign in to comment.