Skip to content

Commit

Permalink
Merge pull request #1 from Fox32/master
Browse files Browse the repository at this point in the history
Make it possible to pass a GitHub token to the action to clone private repositories
  • Loading branch information
edplato authored Jan 9, 2020
2 parents 4c8d686 + 1f4acfa commit 38ff594
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ steps:

*if custom options argument string is used, it will overwrite default settings

### Private GitHub Repository

Pass a GitHub access token to action to clone from a private GitHub repository. You can't use the default `GITHUB_TOKEN` as it doesn't have the permission to clone the repository. You have to create an access token manually.

```yaml
steps:
- uses: actions/checkout@master
- name: trufflehog-actions-scan
uses: edplato/trufflehog-actions-scan@master
with:
githubToken: ${{ secrets.GITHUB_CLONE_TOKEN }}
```
----
[MIT License](LICENSE)
6 changes: 5 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ author: 'Ed Plato'
runs:
using: 'docker'
image: 'Dockerfile'
inputs:
githubToken:
description: 'GitHub Token to access a privat repository'
required: false
branding:
icon: 'shield'
color: 'yellow'
color: 'yellow'
10 changes: 8 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ if [ -n "$1" ]; then
args="$@" # Overwrite if new options string is provided
fi

githubRepo="https://github.com/$GITHUB_REPOSITORY"
trufflehog $args $githubRepo

if [ -n "${INPUT_GITHUBTOKEN}" ]; then
githubRepo="https://$INPUT_GITHUBTOKEN@github.com/$GITHUB_REPOSITORY"
else
githubRepo="https://github.com/$GITHUB_REPOSITORY"
fi

trufflehog $args $githubRepo

0 comments on commit 38ff594

Please sign in to comment.