Skip to content

Commit 6af4c9c

Browse files
Merge pull request #132 from contentstack/staging
DX | 12-05-2025 | Release
2 parents 4fa8424 + 934a321 commit 6af4c9c

File tree

5 files changed

+1417
-1047
lines changed

5 files changed

+1417
-1047
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v3.5.3
12-
- uses: actions/setup-node@v3.7.0
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v4
1313
with:
14-
node-version: "18.x"
14+
node-version: "22.x"
1515
- run: npm install
1616

1717
- name: install npm packall
@@ -24,7 +24,7 @@ jobs:
2424
# Else New release will be created
2525
- name: Bump version and push tag
2626
id: tag_version
27-
uses: mathieudutour/github-tag-action@v6.1
27+
uses: mathieudutour/github-tag-action@v6.2
2828
with:
2929
github_token: ${{ secrets.GITHUB_TOKEN }}
3030
default_bump: false

.husky/pre-commit

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/usr/bin/env sh
2+
# Pre-commit hook to run Talisman and Snyk scans, completing both before deciding to commit
3+
4+
# Function to check if a command exists
5+
command_exists() {
6+
command -v "$1" >/dev/null 2>&1
7+
}
8+
9+
# Check if Talisman is installed
10+
if ! command_exists talisman; then
11+
echo "Error: Talisman is not installed. Please install it and try again."
12+
exit 1
13+
fi
14+
15+
# Check if Snyk is installed
16+
if ! command_exists snyk; then
17+
echo "Error: Snyk is not installed. Please install it and try again."
18+
exit 1
19+
fi
20+
21+
# Allow bypassing the hook with an environment variable
22+
if [ "$SKIP_HOOK" = "1" ]; then
23+
echo "Skipping Talisman and Snyk scans (SKIP_HOOK=1)."
24+
exit 0
25+
fi
26+
27+
# Initialize variables to track scan results
28+
talisman_failed=false
29+
snyk_failed=false
30+
31+
# Run Talisman secret scan
32+
echo "Running Talisman secret scan..."
33+
talisman --githook pre-commit > talisman_output.log 2>&1
34+
talisman_exit_code=$?
35+
36+
if [ $talisman_exit_code -eq 0 ]; then
37+
echo "Talisman scan passed: No secrets found."
38+
else
39+
echo "Talisman scan failed (exit code $talisman_exit_code). See talisman_output.log for details."
40+
talisman_failed=true
41+
fi
42+
43+
# Run Snyk vulnerability scan (continues even if Talisman failed)
44+
echo "Running Snyk vulnerability scan..."
45+
snyk test --all-projects --fail-on=all > snyk_output.log 2>&1
46+
snyk_exit_code=$?
47+
48+
if [ $snyk_exit_code -eq 0 ]; then
49+
echo "Snyk scan passed: No vulnerabilities found."
50+
elif [ $snyk_exit_code -eq 1 ]; then
51+
echo "Snyk found vulnerabilities. See snyk_output.log for details."
52+
snyk_failed=true
53+
else
54+
echo "Snyk scan failed with error (exit code $snyk_exit_code). See snyk_output.log for details."
55+
snyk_failed=true
56+
fi
57+
58+
# Evaluate results after both scans
59+
if [ "$talisman_failed" = true ] || [ "$snyk_failed" = true ]; then
60+
echo "Commit aborted due to issues found in one or both scans."
61+
[ "$talisman_failed" = true ] && echo "- Talisman issues: Check talisman_output.log"
62+
[ "$snyk_failed" = true ] && echo "- Snyk issues: Check snyk_output.log"
63+
exit 1
64+
fi
65+
66+
# If both scans pass, allow the commit
67+
echo "All scans passed. Proceeding with commit."
68+
rm -f talisman_output.log snyk_output.log
69+
exit 0

.talismanrc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ fileignoreconfig:
22
- filename: .github/workflows/secrets-scan.yml
33
ignore_detectors:
44
- filecontent
5-
- filename: package-lock.json
6-
checksum: 4dc3e113527983251f6351c3fbfb9bc6129331c3ee85a78f10d72cdcc9de8186
7-
- filename: src/commands/cm/stacks/validate-regex.ts
8-
checksum: 883813675c599a981450130bcd377eb44aad27bf86628c56bfc89a7f1ac47d5e
9-
- filename: messages/index.json
10-
checksum: 01e9c9b943bfa1ebe6e7d6bede86b55b08641d64b9cc8af6cedea5c0a6273468
5+
- filename: package-lock.json
6+
checksum: f5ee5780b8631eb4cfc7186057e47683089a38d45baa7208488d3e5f702c7bf5
7+
- filename: src/commands/cm/stacks/validate-regex.ts
8+
- filename: .husky/pre-commit
9+
checksum: 1b9367d219802de2e3a8af9c5c698e0c255c00af89339d73bdbb8acf5275079f
10+
- filename: messages/index.json
11+
checksum: 01e9c9b943bfa1ebe6e7d6bede86b55b08641d64b9cc8af6cedea5c0a6273468
1112
version: ""

0 commit comments

Comments
 (0)