Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
...updating entrypoint.sh and action.yml to enable a GitHub Action input variable config-path allowing to set the .gitleaks.toml file path
  • Loading branch information
crazy-matt committed Jan 12, 2021
1 parent 4c9b1f9 commit 1d9f40b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,22 @@ jobs:
```

### Using your own .gitleaks.toml configuration
Include a .gitleaks.toml in the root of your repo directory.
```
name: gitleaks
on: [push,pull_request]
jobs:
gitleaks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: gitleaks-action
uses: zricethezav/gitleaks-action@master
with:
config-path: security/.gitleaks.toml
```
> The `config-path` is relative to your GitHub Worskpace

### NOTE!!!
You must use `actions/checkout` before the gitleaks-action step. If you are using `actions/checkout@v2` you must specify a commit depth other than the default which is 1.
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ description: Run Gitleaks on Push and PR events
branding:
color: purple
icon: eye
inputs:
config-path:
description: 'Path to config (relative to $GITHUB_WORKSPACE)'
required: false
default: '.github/.gitleaks.toml'
outputs:
result: # id of output
description: 'Gitleaks log output'
Expand All @@ -11,3 +16,5 @@ outputs:
runs:
using: "docker"
image: "Dockerfile"
args:
- ${{ inputs.config-path }}
9 changes: 6 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash

INPUT_CONFIG_PATH="$1"
CONFIG=""
# check if using gitleaks config or not
if [ -f "$GITHUB_WORKSPACE/.gitleaks.toml" ]
then

# check if a custom config have been provided
if [ -f "$GITHUB_WORKSPACE/$INPUT_CONFIG_PATH" ]; then
CONFIG=" --config-path=$GITHUB_WORKSPACE/$INPUT_CONFIG_PATH"
else
CONFIG=" --config-path=$GITHUB_WORKSPACE/.gitleaks.toml"
fi

Expand Down

0 comments on commit 1d9f40b

Please sign in to comment.