1
0
Fork 0
mirror of https://github.com/carhartl/talisman-secrets-scan-action.git synced 2025-04-13 11:24:38 +00:00

Compare commits

...

28 commits
v1.0 ... main

Author SHA1 Message Date
Klaus Hartl
263098b1a2
Test for release script dependency 2023-02-19 12:50:56 +01:00
Klaus Hartl
b4df355506
Automate creating GitHub release
Creating a release draft, so that I can manually add release notes.
2023-02-19 12:46:50 +01:00
Klaus Hartl
94f83dd582
Ensure commits/tags are signed 2023-02-18 16:27:44 +01:00
Klaus Hartl
563f193bef
Change message to be less misleading 2023-02-18 16:16:30 +01:00
Klaus Hartl
f82ff5669a
Add release automation script 2023-02-18 16:13:52 +01:00
Klaus Hartl
12bec60c51
Add lefthook based git hooks setup 2023-02-18 10:09:18 +01:00
Klaus Hartl
85f9ff954a
Apply prettier fixes 2023-02-18 10:08:35 +01:00
Klaus Hartl
702fc5c521
Update readme for v1.4.0 2023-02-17 12:08:28 +01:00
Klaus Hartl
d56726748f
Bump talisman from 1.28.1 to 1.30.0
Closes 
2023-02-17 11:59:47 +01:00
Klaus Hartl
12d841b00c
Update checksum for readme 2022-08-15 14:13:22 +02:00
Klaus Hartl
6248162278
Update readme for v1.3.0 2022-08-15 14:07:41 +02:00
Klaus Hartl
a94edcf206
Bump talisman from 1.26.0 to 1.28.1 2022-08-15 14:05:25 +02:00
Klaus Hartl
914217b877
Update readme for v1.2.1 2022-04-14 06:55:56 +02:00
Klaus Hartl
4c9d9387c9
Add safe directory git config 2022-04-13 17:47:21 +02:00
Klaus Hartl
efb785d972
Remove trailing whitespace 2022-04-13 14:59:16 +02:00
Klaus Hartl
fb8e2e061a
Ensure to use up-to-date git 2022-04-13 14:50:12 +02:00
Klaus Hartl
59909d04b2
Update readme for new release 2022-03-11 10:08:16 +01:00
Klaus Hartl
c0a2d6f261
Upgrade Talisman to v1.26.0 2022-03-11 09:54:18 +01:00
Klaus Hartl
febec4e37a
Update readme for new release 2022-03-10 18:42:32 +01:00
Klaus Hartl
9b5b58e1c5
Upgrade Talisman to v1.25.0 2022-03-10 15:03:59 +01:00
Klaus Hartl
832c27cc84
Add .talismanrc 2021-09-23 20:52:39 +02:00
Klaus Hartl
cd348e9954
Brush up readme 2021-09-23 20:48:14 +02:00
Klaus Hartl
4a31b2b153
Downgrade Talisman to v1.11.0
Overlooked that v1.22.0 was a preview anyway, there was a problem with
entries in .talismanrc not correctly being considered.

For some reason v1.11.0 didn't run in Alpine though, thus I switched to
Ubuntu.

Fixes 
2021-09-23 20:39:28 +02:00
Klaus Hartl
9946bb8931
Run test workflow from any branch for testing 2021-09-23 18:02:15 +02:00
Klaus Hartl
75300727c3
Detect in regular incoming commits on main 2021-09-20 09:37:00 +02:00
Klaus Hartl
53433b6440
Revert "Add secret for testing"
This reverts commit a32a5c7e1a.
2021-09-20 09:35:49 +02:00
Klaus Hartl
e503e9b5c3
Make example in readme easier to copy&paste 2021-09-20 09:29:49 +02:00
Klaus Hartl
b80ec236d9
Make example work with proper version
As released..
2021-09-20 09:27:30 +02:00
8 changed files with 76 additions and 11 deletions

View file

@ -2,7 +2,6 @@ name: Test
on:
push:
branches: [main]
workflow_dispatch:
jobs:
@ -15,5 +14,3 @@ jobs:
fetch-depth: 0 # Ensure Talisman can operate on a valid revision range
- name: Test action
uses: ./
with:
remote-sha: 89df42eb70ebff472b384403e6b17e44391eba79

3
.talismanrc Normal file
View file

@ -0,0 +1,3 @@
fileignoreconfig:
- filename: README.md
checksum: 6645dc4ac99294dd313e0c696499112aa0efc455627d7b9982e791559d727ada

View file

@ -1,8 +1,12 @@
FROM alpine:3.13.6
FROM ubuntu:20.04
RUN apk update && apk add git
ENV DEBIAN_FRONTEND=noninteractive
ADD ["https://github.com/thoughtworks/talisman/releases/download/v1.22.0/talisman_linux_amd64", "/talisman"]
RUN apt update && apt install software-properties-common -y \
&& add-apt-repository ppa:git-core/ppa -y \
&& apt install -y git
ADD ["https://github.com/thoughtworks/talisman/releases/download/v1.30.0/talisman_linux_amd64", "/talisman"]
RUN chmod +x /talisman
COPY entrypoint.sh /entrypoint.sh

View file

@ -5,12 +5,14 @@ This action uses [Talisman](https://thoughtworks.github.io/talisman/) to scan th
## Example usage
```yml
uses: carhartl/talisman-secrets-scan-action@v1
steps:
- name: Detect secrets with Talisman in incoming commits
uses: carhartl/talisman-secrets-scan-action@v1.4.0
```
## Caveat
When using this along with the `actions/checkout@v2` step, you'll need to configure it to fetch the entire history:
When using this along with the `actions/checkout@v2` step you'll need to configure it to avoid a too shallow clone:
```yml
- uses: actions/checkout@v2
@ -18,7 +20,7 @@ When using this along with the `actions/checkout@v2` step, you'll need to config
fetch-depth: 0
```
Otherwise you'll run into talisman erroring out while it's trying to execute git with an invalid revision range:
Otherwise you may run into Talisman erroring out while it's trying to execute git with an invalid revision range:
```
time="2021-09-19T07:07:32Z" level=fatal msg="Git command execution failed" command="git diff 0c4a631e70056a95df1c235d238a80828e07cf9c..a32a5c7e1a3d250bf18a080a44a764d9b93b9690 --name-only --diff-filter=ACM" dir=/github/workspace error="exit status 128" output="fatal: Invalid revision range 0c4a631e70056a95df1c235d238a80828e07cf9c..a32a5c7e1a3d250bf18a080a44a764d9b93b9690\n"

View file

@ -2,4 +2,5 @@
set -e
sh -c "git config --global --add safe.directory $PWD"
sh -c "echo $* | /talisman --githook pre-push"

8
lefthook.yml Normal file
View file

@ -0,0 +1,8 @@
pre-commit:
parallel: true
commands:
shellcheck:
glob: "*.sh"
run: shellcheck {staged_files}
prettier:
run: prettier --check .

View file

@ -1,2 +0,0 @@
user=John
password=7FAB324C-585E-4085-874A-161FBA2AEDE8

52
run.sh Executable file
View file

@ -0,0 +1,52 @@
#!/bin/sh
set -eu
_user() {
printf "\033[0;33m%s\033[0m" "$1"
}
_fail() {
printf "\033[0;31m==> %s\033[0m\n\n" "$1"
}
prep_release() {
if ! git diff-index --quiet HEAD --; then
_fail "Repo must not be dirty"
exit 1
fi
grep -rlZE 'v\d+\.\d+\.\d+' --exclude=Dockerfile --exclude-dir=.git . | xargs sed -i '' 's/v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"$1"'/g'
_user "Prepare release draft on GitHub? "
read -r answer
if [ "$answer" = "y" ]; then
if ! command -v gh > /dev/null 2>&1; then
_fail "Script requires GitHub CLI: \`brew install gh\`"
exit 1
fi
git add --update
git commit -S -m "Prepare for $1 release"
git push origin main
git tag -s "$1" -m "Release $1"
git push --tags
gh release create --draft --latest --title "$1" --verify-tag
gh release view "$1" --web
fi
}
_help() {
echo "Usage: ./run.sh [command]"
echo ""
echo "Available commands:"
echo "prep-release <version> Prepare new release draft"
}
cmd="${1:-}"
case "$cmd" in
"prep-release")
shift
prep_release "$@"
;;
*) _help ;;
esac