Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to run the secret scanning on a branch #19

Open
writemevm opened this issue Apr 28, 2024 · 1 comment
Open

Option to run the secret scanning on a branch #19

writemevm opened this issue Apr 28, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@writemevm
Copy link

Option to run the secret scanning on a branch. Is it possible to run this action against a branch instead of PR ?

@felickz
Copy link
Collaborator

felickz commented Apr 29, 2024

Not currently:

#get the pull request number from the GITHUB_REF environment variable
if ($env:GITHUB_REF -match 'refs/pull/([0-9]+)') {
$PullRequestNumber = $matches[1]
}
else {
#https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
Set-ActionFailed -Message "Action workflow must be run on 'pull_request'. GITHUB_REF is not set to a pull request number"
}

The initial idea of the action was to provide additional information in code review on secrets locations introduced on the PR. How would you envision this working for branch based detection? The list of secrets that are present on a branch may be exhaustive (as is git history). One viable solution might be to use a base/head compare to show which secrets are newly detected compared to the base. This would echo how the dependency-review-action behaves as well:
https://github.com/actions/dependency-review-action/blob/0659a74c94536054bfa5aeb92241f70d680cc78e/action.yml#L25-L30

The base git ref to be used for this check. Has a default value when the workflow event is pull_request or pull_request_target. Must be provided otherwise.

@felickz felickz added the enhancement New feature or request label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants