Github secrets checked into code
When using this action on a repo with secrets, my secret is added as a file, committed to the branch and is visible in the PR
Steps to reproduce.
- Add secret to repo
- Use action in workflow
- Run action
- View pr

Hi @scottmelhop
There are two main solutions to avoid including modified or new files in a PR.
-
Add the paths of artifacts you don't want to be committed to
.gitignore. This is very simple and should be a good way to solve the problem if you can determine the path beforehand. For example, if temporary files (that you don't want to be committed) are being created in a workflow, create them in a directory calledtempand include that directory in your.gitignore. -
Make your own commits as described here containing just the paths that you want. After you have made the commits execute the following commands to remove all other changes. The first command stages all other changes, then git resets to delete them. (You need to stage them first otherwise git reset won't delete untracked files).
git add -A git reset --hard HEAD
Yes there are ways around it, and I think this is actually a bigger flaw with Github actions. I can
- Create an action to show all the secrets in my repo
- Create a PR against a protected branch that I can then approve as the reviewer, effectively disabling that level of branch protection
For our organisation this will likely be a security risk and we will have github actions disabled. :(