File tree Expand file tree Collapse file tree 2 files changed +60
-1
lines changed
charts/hwameistor-operator Expand file tree Collapse file tree 2 files changed +60
-1
lines changed Original file line number Diff line number Diff line change 1+ name : Auto Commit with Custom Branch
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ branch_name :
7+ description : ' Enter the new branch name'
8+ required : true
9+ type : string
10+
11+ jobs :
12+ execute-and-commit :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout main branch
16+ uses : actions/checkout@v4
17+ with :
18+ ref : main
19+
20+ - name : Execute test.sh with input
21+ run : |
22+ cd ./storage-charts-repackage/charts/hwameistor-operator
23+ chmod +x upgrade_hwameistor-operator.sh
24+ ./upgrade_hwameistor-operator.sh "${{ github.event.inputs.branch_name }}"
25+
26+ - name : Configure Git User
27+ run : |
28+ git config --global user.name "GitHub Actions"
29+ git config --global user.email "actions@github.com"
30+
31+ - name : Create and Push Custom Branch
32+ run : |
33+
34+ NEW_BRANCH="${{ github.event.inputs.branch_name }}"
35+
36+
37+ if [[ ! "$NEW_BRANCH" =~ ^[a-zA-Z0-9_-]+$ ]]; then
38+ echo "Error: Invalid branch name!"
39+ exit 1
40+ fi
41+
42+
43+ if git ls-remote --exit-code --heads origin "$NEW_BRANCH"; then
44+ echo "Error: Branch $NEW_BRANCH already exists!"
45+ exit 1
46+ fi
47+
48+ git checkout -b "$NEW_BRANCH"
49+
50+ if git status --porcelain; then
51+ git add .
52+ git commit -m "Auto-commit: $NEW_BRANCH"
53+ git push origin "$NEW_BRANCH"
54+ echo "Successfully pushed to $NEW_BRANCH"
55+ else
56+ echo "No changes to commit"
57+ fi
58+ env :
59+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
Original file line number Diff line number Diff line change 22# # hwameistor-operator repo: https://github.com/hwameistor/hwameistor-operator
33
44# /bin/bash
5-
5+ set -x
66releaseVersion=$1
77
88[ " $releaseVersion " == " " ] && \
You can’t perform that action at this time.
0 commit comments