File tree Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Expand file tree Collapse file tree 1 file changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Merge Branch
2+
3+ on :
4+ workflow_call :
5+ inputs :
6+ source_branch :
7+ description : ' The source branch to merge from (e.g., main, testnet)'
8+ required : true
9+ type : string
10+ target_branch :
11+ description : ' The target branch to merge into (e.g., testnet, mainnet)'
12+ required : true
13+ type : string
14+
15+ permissions :
16+ contents : write
17+
18+ jobs :
19+ merge :
20+ runs-on : ubuntu-latest
21+ steps :
22+ - name : Checkout repository
23+ uses : actions/checkout@v4
24+ with :
25+ fetch-depth : 0
26+
27+ - name : Set up Git user
28+ run : |
29+ git config user.name "github-actions[bot]"
30+ git config user.email "github-actions[bot]@users.noreply.github.com"
31+
32+ - name : Merge and Push
33+ run : |
34+ echo "Source: ${{ inputs.source_branch }}"
35+ echo "Target: ${{ inputs.target_branch }}"
36+
37+ SOURCE_COMMIT_SHA=$(git rev-parse origin/${{ inputs.source_branch }})
38+
39+ git checkout ${{ inputs.target_branch }}
40+ git pull origin ${{ inputs.target_branch }} --ff-only
41+
42+ COMMIT_MESSAGE="Merge commit '$SOURCE_COMMIT_SHA' into ${{ inputs.target_branch }}"
43+ echo "Using commit message: $COMMIT_MESSAGE"
44+
45+ git merge --no-ff origin/${{ inputs.source_branch }} -m "$COMMIT_MESSAGE"
46+
47+ echo "Pushing changes to ${{ inputs.target_branch }}..."
48+ git push origin ${{ inputs.target_branch }}
You can’t perform that action at this time.
0 commit comments