Skip to content

Commit 88accd2

Browse files
committed
Harden release permissions and git identity
1 parent 2850f32 commit 88accd2

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

docs/DEVELOPMENT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ Replace `<ACCOUNT_ID>`, `<REGION>`, `<S3_BUCKET_PROD>`, and `<S3_BUCKET_DEV>` to
368368
"Action": [
369369
"serverlessrepo:ListApplications",
370370
"serverlessrepo:CreateApplication",
371+
"serverlessrepo:GetApplication",
371372
"serverlessrepo:UpdateApplication",
372373
"serverlessrepo:CreateApplicationVersion",
373374
"serverlessrepo:CreateCloudFormationTemplate",

scripts/release.sh

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ template_wrapper="$root/template.yaml"
2323
template_arm64="$root/template-arm64.yaml"
2424
template_amd64="$root/template-amd64.yaml"
2525

26+
ensure_git_identity() {
27+
git_name=$(git config user.name 2>/dev/null || true)
28+
git_email=$(git config user.email 2>/dev/null || true)
29+
if [ -z "$git_name" ]; then
30+
git config user.name "github-actions[bot]"
31+
fi
32+
if [ -z "$git_email" ]; then
33+
git config user.email "github-actions[bot]@users.noreply.github.com"
34+
fi
35+
}
36+
2637
cd "$root"
2738

2839
current_branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || true)
@@ -173,14 +184,7 @@ if ! gh auth status >/dev/null 2>&1; then
173184
fi
174185

175186
if ! git diff --quiet HEAD -- "$template_wrapper" "$template_arm64" "$template_amd64"; then
176-
git_name=$(git config user.name 2>/dev/null || true)
177-
git_email=$(git config user.email 2>/dev/null || true)
178-
if [ -z "$git_name" ]; then
179-
git config user.name "github-actions[bot]"
180-
fi
181-
if [ -z "$git_email" ]; then
182-
git config user.email "github-actions[bot]@users.noreply.github.com"
183-
fi
187+
ensure_git_identity
184188
git add "$template_wrapper" "$template_arm64" "$template_amd64"
185189
git commit -m "Release $version"
186190
git push origin "$current_branch"
@@ -210,6 +214,7 @@ if [ "$tag_exists" = "true" ]; then
210214
exit 0
211215
fi
212216

217+
ensure_git_identity
213218
git tag -a "$version" -m "Release $version"
214219
git push origin "$version"
215220

0 commit comments

Comments
 (0)