Skip to content

Commit b0392eb

Browse files
committed
add a protection
1 parent 7ad4bd9 commit b0392eb

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/workflows/new-release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Create Release
33
on:
44
workflow_dispatch:
55
inputs:
6+
are-you-sure:
7+
description: 'Are you sure you want to cut a release? Only "YES!!!" will be accepted'
8+
required: true
69
version:
710
description: 'Version number (leave empty to auto-increment)'
811
required: false
@@ -30,7 +33,12 @@ jobs:
3033
env:
3134
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3235
run: |
33-
FLAGS=""
36+
if [[ "${{ inputs.are-you-sure }}" != "YES!!!" ]]; then
37+
echo "Error: You must enter 'YES!!!' to confirm."
38+
exit 1
39+
fi
40+
41+
FLAGS="-are-you-sure='${{ inputs.are-you-sure }}'"
3442
3543
# Add version flag if provided
3644
if [ -n "${{ inputs.version }}" ]; then

make_release.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,16 @@ func (rm *ReleaseManager) CreateGitHubRelease(version string) error {
320320

321321
func main() {
322322
var (
323-
versionFlag = flag.String("version", "", "Version number (e.g., 1.2.3)")
324-
repoPathFlag = flag.String("repo", ".", "Path to git repository")
323+
versionFlag = flag.String("version", "", "Version number (e.g., 1.2.3)")
324+
repoPathFlag = flag.String("repo", ".", "Path to git repository")
325+
areYouSureFlag = flag.String("are-you-sure", "", "Confirmation to proceed")
325326
)
326327
flag.Parse()
327328

329+
if *areYouSureFlag != "YES!!!" {
330+
log.Fatalf("Confirmation not provided. Please use -are-you-sure='YES!!!'")
331+
}
332+
328333
// Initialize release manager
329334
rm, err := NewReleaseManager(*repoPathFlag)
330335
if err != nil {

0 commit comments

Comments
 (0)