mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2026-06-15 13:24:37 +00:00
1.3 KiB
1.3 KiB
Testing
Most testing is handled automatically by our GitHub Actions workflows.
Local GitHub Action Testing
In some cases you may wish to submit changes to the Trufflehog GitHub Action. Unfortunately GitHub does not provide a 1st-party testing environment for testing actions outside of GitHub Actions.
Fortunately nektos/act enables local testing of GitHub Actions.
Instructions
- Please follow the installation instructions for your OS.
- The first run of
actwill ask you to specify an image.Mediumshould suffice. - You'll need to configure a personal-access-token(PAT) with:
repo:status,repo_deployment, andpublic_repopermissions. - Set an environment variable named
GITHUB_TOKENwith the PAT from the previous step as the value:$ export GITHUB_TOKEN=<your_PAT> - Run the following command from the repository root:
act pull_request -j test -W .github/workflows/secrets.yml -s GITHUB_TOKEN --defaultbranch main - If the job was successful, you should expect to see output from the scanner showing several detected secrets.
- If you want to omit the context of a pull request event and just test that the action starts successfully, run:
act -j test -W .github/workflows/secrets.yml -s GITHUB_TOKEN --defaultbranch main